protected bool AdapterLogin() { CommandMsgV2 cm = new CommandMsgV2(); cm.TK_CommandType = Constants.TK_CommandType.ADAPTER_LOGIN; cm.SetValue(Constants.MSG_PARANAME_ADAPTER_NAME, Name); cm.SetValue(Constants.MSG_PARANAME_ADAPTER_ADDRESS, m_CommClient.LocalIP.ToString()); cm.SetValue(Constants.MSG_PARANAME_ADAPTER_CONTROLLER_PORT, ControllerPort); try { CommandMsgV2 resp = m_CommClient.SendCommand(cm) as CommandMsgV2; if (resp == null) { return(false); } if (resp.Contains(Constants.MSG_PARANAME_RESULT)) { switch (resp.GetValue(Constants.MSG_PARANAME_RESULT).ToString()) { case "OK": return(true); default: return(false); } } else { return(false); } } catch (Exception ex) { SendLog(ex.ToString()); return(false); } }
protected bool AdapterLogout() { CommandMsgV2 cm = new CommandMsgV2(); cm.TK_CommandType = Constants.TK_CommandType.ADAPTER_LOGOUT; try { CommandMsgV2 resp = m_CommClient.SendCommand(cm) as CommandMsgV2; if (resp == null) { return(false); } if (resp.Contains(Constants.MSG_PARANAME_RESULT)) { switch (resp.GetValue(Constants.MSG_PARANAME_RESULT).ToString()) { case "OK": return(true); default: return(false); } } else { return(false); } } catch (Exception ex) { SendLog(ex.ToString()); return(false); } }