public void setZoneName(string strName) { byte[] tmp = UtilCover.stringToBytes(strName, maxEdLen); // string hex= BitConverter.ToString(tmp) // Debug.WriteLine("set zone look hex con: " + hex); Array.Clear(m_singleZone, 0, CDefine.Len_PresetName); Array.Copy(tmp, m_singleZone, tmp.Length); }
private void edZone_TextChanged(object sender, TextChangedEventArgs e) { var box = sender as TextBox; string strInput = box.Text.Trim(); byte[] tmp = UtilCover.stringToBytes(strInput, CDefine.Len_FactPName); if (m_ZoneName == null) { m_ZoneName = new byte[Max_len]; } else { Array.Clear(m_ZoneName, 0, Max_len); } Array.Copy(tmp, m_ZoneName, tmp.Length); }
private void ConnectSerialPort() { if (ConnectionType) { if (_SelectedBaudRateIndex == -1 || _SelectedSerialPortIndex == -1) { MessageBox.Show("please select baud and serialport"); return; } if (MySerialPort.IsOpen) { MySerialPort.Close(); Data.UpdateState = false; } else { MySerialPort.PortName = SerialPortNames[_SelectedSerialPortIndex]; MySerialPort.BaudRate = int.Parse(_BaudStringArray[_SelectedBaudRateIndex]); try { MySerialPort.Open(); Data.NetConnection = false; } catch { MessageBox.Show("Fail to connect device"); } } Data.ConnectionState = MySerialPort.IsOpen; } else { try { if (MyNetPort.isConnected()) { //disconnnect MyNetPort.disConnect(); Data.UpdateState = false; } else { string strip = Data.IP; if (string.IsNullOrEmpty(strip)) { MessageBox.Show("Ip cannot be empty, please scan device firstly"); return; } else if (!UtilCover.IPCheck(strip)) { MessageBox.Show("Ip inputed is invalided"); return; } else if (MyNetPort != null) { MyNetPort.connect(Data.IP.Trim()); Data.NetConnection = true; } } } catch (Exception ec) { Debug.WriteLine(" proces error {0}", ec.ToString()); } } }
public void refreshZoneEdit() { edZone.Text = UtilCover.bytesToString(m_ZoneName, CDefine.Len_FactPName); }
public String getZoneName(int index) { return(UtilCover.bytesToString(m_ZoneName[index], CDefine.Len_FactPName)); }
public string getZoneName() { return(UtilCover.bytesToString(m_singleZone, CDefine.Len_FactPName)); //fact 16 len }
public void setDevName(string strname) //rpm100 only keep for save 8 length byte { byte[] tmp = UtilCover.stringToBytes(strname, CDefine.Len_FactPName); Array.Clear(m_DeviceName, 0, LEN_DEVN); Array.Copy(tmp, m_DeviceName, tmp.Length); }
public string nameofDevice() { return(UtilCover.bytesToString(m_DeviceName, CDefine.Len_FactPName)); //fact 16 len }
public void setRMPZoneName(int index, string strname) //rpm100 only keep for save 8 length byte { byte[] tmp = UtilCover.stringToBytes(strname, CDefine.LEN_DeviceName); Array.Clear(m_zoneName[index], 0, CDefine.Len_PresetName); Array.Copy(tmp, m_zoneName[index], tmp.Length); }
public string nameOfZone(int chindex) //chindex 0..192 { return(UtilCover.bytesToString(m_zoneName[chindex], CDefine.Len_FactPName)); //fact 16 len }