public DeviceInfo(string _deviceIPAddresss, int connectTime) { communicationFrame = new CommunicationFrame(); ResetDevice(); deviceIPAddress = _deviceIPAddresss; lastConnectTimeMS = connectTime; }
static public string GetStreamClientName(string dataStream) { string retValue = string.Empty; try { CommunicationFrame communicationFrame = new CommunicationFrame(); communicationFrame = fastJSON.JSON.ToObject <CommunicationFrame>(dataStream); retValue = communicationFrame.data[0].ToString(); } catch (Exception) { }; return(retValue); }
public void DoEvents(int callTime, string dataStream) { try { lastConnectTimeMS = callTime; communicationFrame.Clear(); communicationFrame = fastJSON.JSON.ToObject <CommunicationFrame>(dataStream); if (communicationState == CommunicationState.DISCONNECTED || communicationState == CommunicationState.WAITFORDATA) { ProcessStream(); communicationState = CommunicationState.SENDRESP; } if (communicationState == CommunicationState.SENDRESP) { string sendStream = StreamBuilder(CommandList.RESP_OK); Communication.SendStream(deviceIPAddress, sendStream); DebugInfo.debugInfo.Add("设备" + deviceName + " (" + deviceIPAddress + ") 发送: " + sendStream); communicationState = CommunicationState.WAITFORDATA; } } catch (Exception) { }; }