protected virtual void OnSetCallParamsOKReceived(object sender, StringDataReceivedEventArgs e) { if (SetCallParamsOKReceived != null) { SetCallParamsOKReceived(sender, e); } }
protected virtual void OnUSSDCommandReceived(object sender, StringDataReceivedEventArgs e) { if (USSDCommandReceived != null) { USSDCommandReceived(sender, e); } }
protected virtual void OnGetADCParamsReceived(object sender, StringDataReceivedEventArgs e) { if (GetADCParamsReceived != null) { GetADCParamsReceived(sender, e); } }
protected virtual void OnGetUserNumberReceived(object sender, StringDataReceivedEventArgs e) { if (GetUserNumberReceived != null) { GetUserNumberReceived(sender, e); } }
protected virtual void OnGetTimeActivationReceived(object sender, StringDataReceivedEventArgs e) { if (GetTimeActivationReceived != null) { GetTimeActivationReceived(sender, e); } }
protected virtual void OnDeviceVersionReceived(object sender, StringDataReceivedEventArgs e) { if (DeviceVersionReceived != null) { DeviceVersionReceived(sender, e); } }
protected virtual void OnErrorReceived(object sender, StringDataReceivedEventArgs e) { if (ErrorReceived != null) { ErrorReceived(sender, e); } }
protected virtual void OnSetTimeDeactivationOKReceived(object sender, StringDataReceivedEventArgs e) { if (SetTimeDeactivationOKReceived != null) { SetTimeDeactivationOKReceived(sender, e); } }
void listener_GetADCParamsReceived(object sender, StringDataReceivedEventArgs e) { switch (e.Message[0]) { case '0': this.Invoke(setValue, zone1MinBox, Convert.ToInt32(e.Message.Substring(1, 2), 16).ToString()); this.Invoke(setValue, zone1MaxBox, Convert.ToInt32(e.Message.Substring(3, 2), 16).ToString()); break; case '1': this.Invoke(setValue, zone2MinBox, Convert.ToInt32(e.Message.Substring(1, 2), 16).ToString()); this.Invoke(setValue, zone2MaxBox, Convert.ToInt32(e.Message.Substring(3, 2), 16).ToString()); break; case '2': this.Invoke(setValue, zone3MinBox, Convert.ToInt32(e.Message.Substring(1, 2), 16).ToString()); this.Invoke(setValue, zone3MaxBox, Convert.ToInt32(e.Message.Substring(3, 2), 16).ToString()); break; case '3': this.Invoke(setValue, zone4MinBox, Convert.ToInt32(e.Message.Substring(1, 2), 16).ToString()); this.Invoke(setValue, zone4MaxBox, Convert.ToInt32(e.Message.Substring(3, 2), 16).ToString()); break; } }
void listener_GetCurrentADCReceived(object sender, StringDataReceivedEventArgs e) { this.Invoke(setValue, zone1CurrBox, Convert.ToInt32(e.Message.Substring(0, 2), 16).ToString()); this.Invoke(setValue, zone2CurrBox, Convert.ToInt32(e.Message.Substring(2, 2), 16).ToString()); this.Invoke(setValue, zone3CurrBox, Convert.ToInt32(e.Message.Substring(4, 2), 16).ToString()); this.Invoke(setValue, zone4CurrBox, Convert.ToInt32(e.Message.Substring(6, 2), 16).ToString()); }
void listener_GetUserNumberReceived(object sender, StringDataReceivedEventArgs e) { switch (e.Message[0]) { case '0': this.Invoke(setValue, user1NumBox, e.Message.Substring(1)); break; case '1': this.Invoke(setValue, user2NumBox, e.Message.Substring(1)); break; case '2': this.Invoke(setValue, user3NumBox, e.Message.Substring(1)); break; case '3': this.Invoke(setValue, user4NumBox, e.Message.Substring(1)); break; case '4': this.Invoke(setValue, user5NumBox, e.Message.Substring(1)); break; } }
void listener_GetTimeActivationReceived(object sender, StringDataReceivedEventArgs e) { int time = int.Parse(e.Message, System.Globalization.NumberStyles.HexNumber); this.Invoke(setValue, activationTimeBox, time.ToString()); listener.EndListening(); }
void listener_GetCurrentADCReceived(object sender, StringDataReceivedEventArgs e) { int[] cur = new int[4]; int[] min = new int[4]; int[] max = new int[4]; if (int.TryParse(e.Message.Substring(0, 2), System.Globalization.NumberStyles.HexNumber, null, out cur[0]) && int.TryParse(e.Message.Substring(2, 2), System.Globalization.NumberStyles.HexNumber, null, out cur[1]) && int.TryParse(e.Message.Substring(4, 2), System.Globalization.NumberStyles.HexNumber, null, out cur[2]) && int.TryParse(e.Message.Substring(6, 2), System.Globalization.NumberStyles.HexNumber, null, out cur[3])) { for (int i = 0; i < 4; i++) { min[i] = cur[i] - (cur[i] / 10); max[i] = cur[i] + (cur[i] / 10); if (min[i] < 0) { min[i] = 0; } if (max[i] > 255) { max[i] = 255; } SetADCParams(i, min[i], max[i]); } MessageBox.Show("Калибровка завершена", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Устройство вернуло неверные данные. Проверьте правильность подключения", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } listener.EndListening(); listener.GetCurrentADCReceived -= currentADCReceivedHandler; }
void listener_SetActiveZonesOKReceived(object sender, StringDataReceivedEventArgs e) { if (isMultiCommand) { commandCount++; if (commandCount > 8) { EndOfMultiCommand(); } } else { MessageBox.Show("Активные зоны успешно установлены", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void listener_SetTimeActivationOKReceived(object sender, StringDataReceivedEventArgs e) { if (isMultiCommand) { commandCount++; if (commandCount > 8) { EndOfMultiCommand(); } } else { MessageBox.Show("Время отсрочки активации успешно установлено", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void listener_SetCallParamsOKReceived(object sender, StringDataReceivedEventArgs e) { if (isMultiCommand) { commandCount++; if (commandCount > 8) { EndOfMultiCommand(); } } else { MessageBox.Show("Способы дозвона успешно установлены", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void listener_SetUserNumberOKReceived(object sender, StringDataReceivedEventArgs e) { //WriteLog("Номер пользователя успешно установлен"); if (isMultiCommand) { commandCount++; if (commandCount > 8) { EndOfMultiCommand(); } } else { MessageBox.Show("Номер пользователя успешно установлен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void listener_ErrorReceived(object sender, StringDataReceivedEventArgs e) { if (isMultiCommand) { commandCount++; wasError = true; if (commandCount > 8) { EndOfMultiCommand(); } } else { MessageBox.Show(e.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } listener.EndListening(); }
void listener_GetActiveZonesReceived(object sender, StringDataReceivedEventArgs e) { byte paramByte = byte.Parse(e.Message, System.Globalization.NumberStyles.HexNumber); //if (byte.TryParse(e.Message,System.Globalization.NumberStyles.HexNumber,null,out paramByte)) //{ if ((paramByte & 1) == 0) { this.Invoke(setValue, zone1EnableCheckBox, "false"); } else { this.Invoke(setValue, zone1EnableCheckBox, "true"); } if ((paramByte & 2) == 0) { this.Invoke(setValue, zone2EnableCheckBox, "false"); } else { this.Invoke(setValue, zone2EnableCheckBox, "true"); } if ((paramByte & 4) == 0) { this.Invoke(setValue, zone3EnableCheckBox, "false"); } else { this.Invoke(setValue, zone3EnableCheckBox, "true"); } if ((paramByte & 8) == 0) { this.Invoke(setValue, zone4EnableCheckBox, "false"); } else { this.Invoke(setValue, zone4EnableCheckBox, "true"); } //} //else // MessageBox.Show("Устройство вернуло неверные данные. Проверьте правильность подключения", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
void listener_USSDCommandReceived(object sender, StringDataReceivedEventArgs e) { MessageBox.Show(e.Message.Replace('@', '*'), "USSD", MessageBoxButtons.OK, MessageBoxIcon.Information); }
void listener_SetDefaultsOKReceived(object sender, StringDataReceivedEventArgs e) { MessageBox.Show("Параметры по умолчанию успешно установлены", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); }
void listener_DeviceIdReceived(object sender, StringDataReceivedEventArgs e) { //deviceIdLbl.Text = e.Message; this.Invoke(setValue, deviceIdLbl, e.Message); listener.EndListening(); }
void listener_DeviceVersionReceived(object sender, StringDataReceivedEventArgs e) { MessageBox.Show(e.Message, "Версия устройства", MessageBoxButtons.OK, MessageBoxIcon.Information); listener.EndListening(); }
void listener_SetADCParamsOKReceived(object sender, StringDataReceivedEventArgs e) { MessageBox.Show("Параметры калибровки успешно записаны", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); }
void listener_GetCallParamsReceived(object sender, StringDataReceivedEventArgs e) { byte smsByte = byte.Parse(e.Message.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); byte callByte = byte.Parse(e.Message.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); if ((smsByte & 1) == 0) { this.Invoke(setValue, smsUser1CheckBox, "false"); } else { this.Invoke(setValue, smsUser1CheckBox, "true"); } if ((smsByte & 2) == 0) { this.Invoke(setValue, smsUser2CheckBox, "false"); } else { this.Invoke(setValue, smsUser2CheckBox, "true"); } if ((smsByte & 4) == 0) { this.Invoke(setValue, smsUser3CheckBox, "false"); } else { this.Invoke(setValue, smsUser3CheckBox, "true"); } if ((smsByte & 8) == 0) { this.Invoke(setValue, smsUser4CheckBox, "false"); } else { this.Invoke(setValue, smsUser4CheckBox, "true"); } if ((smsByte & 16) == 0) { this.Invoke(setValue, smsUser5CheckBox, "false"); } else { this.Invoke(setValue, smsUser5CheckBox, "true"); } if ((callByte & 1) == 0) { this.Invoke(setValue, callUser1CheckBox, "false"); } else { this.Invoke(setValue, callUser1CheckBox, "true"); } if ((callByte & 2) == 0) { this.Invoke(setValue, callUser2CheckBox, "false"); } else { this.Invoke(setValue, callUser2CheckBox, "true"); } if ((callByte & 4) == 0) { this.Invoke(setValue, callUser3CheckBox, "false"); } else { this.Invoke(setValue, callUser3CheckBox, "true"); } if ((callByte & 8) == 0) { this.Invoke(setValue, callUser4CheckBox, "false"); } else { this.Invoke(setValue, callUser4CheckBox, "true"); } if ((callByte & 16) == 0) { this.Invoke(setValue, callUser5CheckBox, "false"); } else { this.Invoke(setValue, callUser5CheckBox, "true"); } listener.EndListening(); }
void listener_ErrorReceived(object sender, StringDataReceivedEventArgs e) { MessageBox.Show(e.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }