public string GetCMD() { string strTemp = string.Format("$--IPM,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17}", LocalNetIP, DataSvrPort, ConfigSvrPort, LocalNetMask, LocalNetGateway, LocalNetMAC, DestIP1, DestPort1, LocalPort1, DestIP2, DestPort2, LocalPort2, DestIP3, DestPort3, LocalPort3, DestIP4, DestPort4, LocalPort4 ); strTemp += CommHelp.Get0xHH(strTemp); return(strTemp); }
public string GetCMD() { try { string strCMD = string.Format("$--SPO,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13}", BaseID, SelectChannel, RecvSingalStrengthVDL, FisrtSlotNumForFirstRecvMsg, TimeOfMsgArrival, SingalToNoiseRatio, PreFrameCHLoad, NumOfBadCRC, ForecastCHLoad, AverageNoiseLevel, RecvSingalStrength, ProVSISens4VDM, ProVSISens4VDO, ProFSRSens); strCMD += CommHelp.Get0xHH(strCMD); return(strCMD); } catch (Exception) { return(""); } }
void comm_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { if (bCloseing) { return; } bListening = true; int n = comm.BytesToRead; //先记录下来,避免某种原因,人为的原因,操作几次之间时间长,缓存不一致 byte[] buf = new byte[n]; //声明一个临时数组存储当前来的串口数据 comm.Read(buf, 0, n); //读取缓冲数据 switch (_optdataType) { case OptDataType.StringArray: //直接按ASCII规则转换成字符串 string strRecv = Encoding.ASCII.GetString(buf); if (strRecv == null || strRecv.Length < 1) { return; } builder.Append(strRecv); string bulidString = builder.ToString(); builder.Remove(0, builder.Length); //清除字符串构造器的内容 string[] strDataArray = CommHelp.Resolve(ref bulidString); if (onRoute_OutEventHandle != null) { DTAEventArgs args = new DTAEventArgs(); args.FrameArray = strDataArray; onRoute_OutEventHandle((IntPtr)this.GetHashCode(), args); } builder.Append(bulidString); break; case OptDataType.ByteArray: string[] strDataArray2 = new string[] { Encoding.ASCII.GetString(buf) }; if (onRoute_OutEventHandle != null) { DTAEventArgs args = new DTAEventArgs(); args.FrameArray = strDataArray2; onRoute_OutEventHandle((IntPtr)this.GetHashCode(), args); } break; default: break; } bListening = false; } catch (Exception ex) { if (onErrorReportHandle != null) { onErrorReportHandle(this, 102, ex.Message); } } }
public string GetSidCmd() { string sid = string.Format("$--SID,{0},{1},{2},{3}", UniqueID_Cur, UniqueID_New, MMSI_Cur, MMSI_New); sid += CommHelp.Get0xHH(sid); return(sid); }
public string GetCMD() { string strCMD = string.Format("$--CAB,{0},{1},{2},{3}", Tx_A, Tx_B, Reboot, Reset); strCMD += CommHelp.Get0xHH(strCMD); return(strCMD); }
public string GetCMD() { string strCMD = string.Format("$--BCE,{0},{1},{2},{3},{4}", BaseID, RATDMA, UTCSoure, ADSInterval, BlockControl); strCMD += CommHelp.Get0xHH(strCMD); return(strCMD); }
internal string GetCMD() { string strTemp = string.Format("$--ECB,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", BaseID, MsgType, ChAStartTime, ChAStartSlot, ChASlotInterval, ChASlotCounts, ChBStartTime, ChBStartSlot, ChBSlotInterval, ChBSlotCounts ); strTemp += CommHelp.Get0xHH(strTemp); return(strTemp); }
public static string GetCMD(int Seq, string Channel, List <MsgDLM> listTemp) { try { string strCMD = string.Format("$--DLM,{0},{1}", Seq, Channel); for (int i = 0; i < listTemp.Count; i++) { strCMD += "," + listTemp[i].Owner; strCMD += "," + listTemp[i].StartSlot; strCMD += "," + listTemp[i].SlotCounts; strCMD += "," + listTemp[i].Timeout; strCMD += "," + listTemp[i].SlotIncrement; } strCMD += CommHelp.Get0xHH(strCMD); return(strCMD); } catch (Exception) { return(""); } }
public string GetCMD_ATN() { try { string strCMD = string.Format("$--ATN,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23}", Seq, Enable, StartSlotA, SendIntervalA, //StartSlotB, //SendIntervalB, MMSI, Type, Name, PosAccuracy, Latitude, NS, Longitude, EW, Size_A, Size_B, Size_C, Size_D, PosDeviceType, TimeStamp, OffPos_Indicator, AtoNStatus, RAIM_Flag, Virtual_AtoN_Flag, Assigned_Model_Flag, Spare ); strCMD += CommHelp.Get0xHH(strCMD); return(strCMD); } catch (Exception) { return(""); } }
public string GetBCFCmd() { string bcf = string.Format("$--BCF,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}", MMSI, PositionSource, Latitude, NS, Longitude, EW, PositionAccuracy, RxA, RxB, TxA, TxB, PowerLevelA, PowerLevelB, MsgRetries, MsgRepeatIndicator, BaseTalkerID ); bcf += CommHelp.Get0xHH(bcf); return(bcf); }