private void ctrlRobotHardwareStatusHandler(Communication.Message message) { StandardString standardString = (StandardString)message; string row = standardString.data; }
public static string GetDictionaryString() { return("mil" + StandardString.ToLower()); }
private void testHandler(Communication.Message message) { StandardString standardString = (StandardString)message; System.Windows.MessageBox.Show(standardString.data); }
private void multirulestoserverHandler(Communication.Message message) { StandardString standardString = (StandardString)message; String data = standardString.data; }
private void trafficInfoResponseHandler(Communication.Message message) { StandardString standardString = (StandardString)message; String data = standardString.data; }
private void DataHandler(Message message) { StandardString standard = (StandardString)message; try { JObject stuff = JObject.Parse(standard.data); var status = (CLIENTCMD)((int)stuff["status"]); var ip = (string)stuff["ip"]; switch (status) { case CLIENTCMD.REQUEST_PROFILE_ADD: sendProfile(ip, SERVERRESPONSE.RESP_PROFILE_ADD, new List <ProfileRF>()); //dynamic product=new JOb break; case CLIENTCMD.REQUEST_PROFILE_UPDATE: sendProfile(ip, SERVERRESPONSE.RESP_PROFILE_UPDATE, new List <ProfileRF>()); //dynamic product=new JOb break; case CLIENTCMD.REQUEST_PROFILE_DELETE: sendProfile(ip, SERVERRESPONSE.RESP_PROFILE_DELETE, new List <ProfileRF>()); //dynamic product=new JOb break; case CLIENTCMD.CONFIRM_SENT_PROFILE_SUCCESS: OnFlagStatusClient.OnConfirmProfileSuccess = true; break; case CLIENTCMD.REQUEST_SYNC_TIME: dynamic productTimeSync = new JObject(); productTimeSync.status = (int)SERVERRESPONSE.RESP_SYNC_TIME; productTimeSync.data = DateTime.Now.Ticks; StandardString msgTimeSync = new StandardString(); msgTimeSync.data = productTimeSync.ToString(); Publish(publishdata, msgTimeSync); break; case CLIENTCMD.REQUEST_REG_PERSON_LIST: List <CheckinData> personList = new List <CheckinData>(); try { JObject dataClient = JObject.Parse(standard.data); if (dataClient["data"].Count() > 0) { foreach (var result in dataClient["data"]) { string serialId = (string)result["serialId"]; string tick = (string)result["tick"]; CheckinData person = new CheckinData() { SERIAL_ID = serialId, TIMECHECK = tick }; personList.Add(person); } if (personList.Count > 0) { mainWindowModel.CheckinServer(ip, personList); } } try { dynamic product = new JObject(); product.status = SERVERRESPONSE.RESP_SUCCESS; StandardString msg = new StandardString(); msg.data = product.ToString(); Publish(publishdata, msg); } catch (Exception ex) { logFile.Error(ex.Message); Constant.mainWindowPointer.WriteLog(ex.Message); } } catch (Exception ex) { try { dynamic product = new JObject(); product.status = SERVERRESPONSE.RESP_PERSONLIST_ERROR; StandardString msg = new StandardString(); msg.data = product.ToString(); Publish(publishdata, msg); logFile.Error(ex.Message); Constant.mainWindowPointer.WriteLog(ex.Message); } catch (Exception exc) { logFile.Error(exc.Message); Constant.mainWindowPointer.WriteLog(ex.Message); } } break; } } catch (Exception ex) { logFile.Error(ex.Message); Constant.mainWindowPointer.WriteLog(ex.Message); } }
public void sendProfile(string ip, SERVERRESPONSE serverRes, List <ProfileRF> listProfileToSend) { if (webSocket != null) { if (webSocket.IsAlive) { try { if (statusProfile != STATUSPROFILE.Updating) { JStringProfile Jprofile = new JStringProfile(); Jprofile.status = (int)serverRes; Jprofile.data = mainWindowModel.GetListSerialId(ip); if (listProfileToSend.Count > 0) { Jprofile.data = listProfileToSend; } var jsonSettings = new JsonSerializerSettings(); jsonSettings.DateFormatString = "yyyy-MM-dd"; string dataResp = JsonConvert.SerializeObject(Jprofile, jsonSettings); StandardString info = new StandardString(); info.data = dataResp; statusProfile = STATUSPROFILE.Updating; SqliteDataAccess.UpdateDeviceRF(ip, statusProfile.ToString()); mainWindowModel.ReloadListDeviceRFDGV(); this.Publish(publishdata, info); new Thread((MainWindowModel) => { int cntTimeOut = 0; while (cntTimeOut++ < 40) { if (OnFlagStatusClient.OnConfirmProfileSuccess) { break; } Thread.Sleep(1000); } if (OnFlagStatusClient.OnConfirmProfileSuccess) { OnFlagStatusClient.OnConfirmProfileSuccess = false; statusProfile = STATUSPROFILE.Updated; SqliteDataAccess.UpdateDeviceRF(ip, statusProfile.ToString() + " " + DateTime.Now.ToString("MM/dd/yyyy h:mm:ss tt")); } else { statusProfile = STATUSPROFILE.Failed; SqliteDataAccess.UpdateDeviceRF(ip, statusProfile.ToString()); } mainWindowModel.ReloadListDeviceRFDGV(); } ).Start(mainWindowModel); } } catch (Exception ex) { statusProfile = STATUSPROFILE.Error; SqliteDataAccess.UpdateDeviceRF(ip, statusProfile.ToString()); mainWindowModel.ReloadListDeviceRFDGV(); logFile.Error(ex.Message); Constant.mainWindowPointer.WriteLog(ex.Message); } } } }
void Change_ObjName(Message message) { changedname = (StandardString)message; check_topic = true; }
private void DataHandler(Message message) { StandardString standard = (StandardString)message; try { JObject stuff = JObject.Parse(standard.data); var status = (CLIENTCMD)((int)stuff["status"]); var ip = (string)stuff["ip"]; switch (status) { case CLIENTCMD.REQUEST_PROFILE: sendProfile(ip); //dynamic product=new JOb break; case CLIENTCMD.REQUEST_REG_PERSON_LIST: List <CheckinData> personList = new List <CheckinData>(); try { JObject dataClient = JObject.Parse(standard.data); if (dataClient["data"].Count() > 0) { foreach (var result in dataClient["data"]) { string serialId = (string)result["serialId"]; string tick = (string)result["tick"]; CheckinData person = new CheckinData() { SERIAL_ID = serialId, TIMECHECK = tick }; personList.Add(person); } if (personList.Count > 0) { mainWindowModel.CheckinServer(personList); } } try { dynamic product = new JObject(); product.status = SERVERRESPONSE.RESP_SUCCESS; StandardString msg = new StandardString(); msg.data = product.ToString(); Publish(publishdata, msg); } catch (Exception ex) { logFile.Error(ex.Message); } } catch (Exception ex) { try { dynamic product = new JObject(); product.status = SERVERRESPONSE.RESP_PERSONLIST_ERROR; StandardString msg = new StandardString(); msg.data = product.ToString(); Publish(publishdata, msg); logFile.Error(ex.Message); } catch (Exception exc) { logFile.Error(exc.Message); } } break; } } catch (Exception ex) { logFile.Error(ex.Message); } }
private void subscriptionHandler(Communication.Message message) { StandardString standardstring = (StandardString)message; dynamic data = JObject.Parse(standardstring.data); int no_lines = Convert.ToInt32(data.NOL); int no_pallets_per_line = Convert.ToInt32(data.NOPPL); properties.camera.no_lines = no_lines; properties.camera.no_pallet_per_lines = no_pallets_per_line; properties.camera.ip = data.CAMIP; properties.camera.port = data.CAMPORT; properties.camera.id = Convert.ToInt32(data.CAMID); List <bool> palletStatusArray = new List <bool>(no_lines * no_pallets_per_line); if (properties.camera.lines_detail == null) { properties.camera.lines_detail = new SortedDictionary <string, LineDetail>(); } for (int lineIndex = 0; lineIndex < no_lines; lineIndex++) { string line = "L" + lineIndex; LineDetail lineDetail = new LineDetail(); //lineDetail.pallets_detail = new SortedDictionary<string, string>(); bool first = true; for (int palletIndex = 0; palletIndex < no_pallets_per_line; palletIndex++) { string pallet = "PL" + palletIndex; string[] palletStatus = ((string)data[line][pallet]).Split('-'); lineDetail.pallets_detail.Add(palletIndex.ToString(), palletStatus[0]); palletStatusArray.Add((palletStatus[0] == "yes") ? true : false); if (!((palletStatus[1] == ("available") || palletStatus[1] == ("detected")) && (palletStatus[2] == "stable"))) { if (first == true) { lineDetail.valid = false; lineDetail.palletWarning = palletIndex.ToString(); first = false; } } } if (!properties.camera.lines_detail.ContainsKey(lineIndex.ToString())) { //NEW properties.camera.lines_detail.Add(lineIndex.ToString(), lineDetail); properties.pallets_status = palletStatusArray; properties.camera.valid = false; } else { //UPDATE properties.camera.lines_detail[lineIndex.ToString()].pallets_detail = lineDetail.pallets_detail; properties.camera.lines_detail[lineIndex.ToString()].valid = lineDetail.valid; if (lineDetail.palletWarning != "none") { properties.camera.lines_detail[lineIndex.ToString()].palletWarning = lineDetail.palletWarning; } properties.pallets_status = palletStatusArray; properties.camera.valid = false; } } properties.camera.valid = true; if (RegistrationAgent.areaList.Count != 0) { RegistrationAgent.areaList[properties.camera.area].ProcessStation(properties.typeName, properties.stationNameID); } }