public bool InitRequest() { try { packageID = 1; IDStateIDControlRequestBlocking(); PageCountPageIndexRequestBlocking(); SetIDControl(); System.Threading.Thread.Sleep(500); trace("Init send datetime!", TracePrio.MESSAGE); waitPacketID = packageID; Send(XAMUmpDateTime.Create(DateTime.Now, trace)); trace("Init done: state <" + IdState + "> control <" + IdControl + "> PageCount <" + PageCount + "> PageIndex <" + PageIndex + ">", TracePrio.NOTIFICATION); return(true); } catch (Exception ex) { trace("Init failed ex: " + ex.Message, TracePrio.NOTIFICATION); } return(false); }
/// <summary> /// Checks the and connect. /// </summary> /// <returns></returns> public XAMIOConnectionStatus CheckAndConnect() { if (dispatcher.CheckAndConnect() != XAMIOConnectionStatus.Connected) { _IdState = new XAMUmpStateFlags(); return(XAMIOConnectionStatus.notConnected); } HandleTelegramReceived(); if (IdState.InitRequest) { // Send Init Request SetIDControl(); return(XAMIOConnectionStatus.notConnected); } if (IdState.TimeRequest) { Send(XAMUmpDateTime.Create(DateTime.Now, trace)); } if (DateTime.Now.Subtract(IdState.LastStateReceived).Seconds > 10) { SendIDStateIDControlRequest(); } return(XAMIOConnectionStatus.Connected); }