| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace IACommService4CSharp
- {
- public class IACommService_t
- {
- private static IIACommService4CSharp m_commService = null;
- private static GeneralConfig_t m_config = null;
- private static bool m_isInitialised = false;
- public static uint SetLogConfig(LogConfig_t logConfig)
- {
- if (m_isInitialised)
- return ErrorCode.InvalidState;
- if (null == logConfig)
- return ErrorCode.InvalidArgument;
- var logConfigItems = logConfig.GetConfig();
- var config = LogConfig();
- foreach (var configItem in logConfigItems)
- {
- config.SetParameter(configItem.Key, configItem.Value);
- }
- return ErrorCode.Good;
- }
- public static uint Initialise()
- {
- if (m_isInitialised)
- return ErrorCode.InvalidState;
- var commService = Instance();
- if (null == commService)
- return ErrorCode.InternalError;
- var status = commService.Initialise(LogConfig().Internal);
- if (ErrorCode.Good == status)
- m_isInitialised = true;
- return status;
- }
- //Internal use
- public static IIACommService4CSharp Instance()
- {
- if (null == m_commService)
- m_commService = IACommServiceFactory4CSharp.Create();
- return m_commService;
- }
- public static bool IsInitialised
- {
- get
- {
- return m_isInitialised;
- }
- }
- private static GeneralConfig_t LogConfig()
- {
- if (null == m_config)
- m_config = new GeneralConfig_t();
- return m_config;
- }
- }
- }
|