Beispiel #1
0
        public List<MesObject> GetMesList(Byte[] bMsg,int intLenth,String strIpAddr)
        {
            List<MesObject> msjList = new List<MesObject>();
            List<Byte[]> blist = new List<Byte[]>();
            Byte[] btemp = new Byte[MyConfig.INT_INPUT_BYTE_SIZE];

            //先获取完整byte集合
            blist = SpiltMsg(bMsg,intLenth);
            //转换为MesObject集合
            for(int i=0;i<blist.Count;i++)
            {
                MesObject msj = new MesObject();
                msj = DeCode(RevertByte(blist[i]));
                //给对象的客户端地址属性赋值
                msj.ipAddr = strIpAddr;
                msjList.Add(msj);
            }
            return msjList;
        }
Beispiel #2
0
 //按照编码规则进行解码,读取客户端传递的有效信息
 private MesObject DeCode(Byte[] bData)
 {
     String nowtime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
     MesObject mesObject = new MesObject();
     Int32 senddate = BitConverter.ToInt32(bData, 4 * 0);
     Int32 sendtime = BitConverter.ToInt32(bData, 4 * 1);
     Int32 midhead = BitConverter.ToInt32(bData, 4 * 2);
     Int32 midend = BitConverter.ToInt32(bData, 4 * 3);
     Int32 gps_num = BitConverter.ToInt32(bData, 4 * 4);
     Int32 lac = BitConverter.ToInt32(bData, 4 * 5);
     Int32 cid = BitConverter.ToInt32(bData, 4 * 6);
     Int32 rsp = BitConverter.ToInt32(bData, 4 * 7);
     Int32 sensor_x = BitConverter.ToInt32(bData, 4 * 8);
     Int32 sensor_y = BitConverter.ToInt32(bData, 4 * 9);
     Int32 sensor_z = BitConverter.ToInt32(bData, 4 * 10);
     Int32 gpsX_H = BitConverter.ToInt32(bData, 4 * 11);
     Int32 gpsX_L = BitConverter.ToInt32(bData, 4 * 12);
     Int32 gps_h = BitConverter.ToInt32(bData, 4 * 13);
     Int32 networktype = BitConverter.ToInt32(bData, 4 * 14);
     Int32 gpsY_H = BitConverter.ToInt32(bData, 4 * 15);
     Int32 gpsY_L = BitConverter.ToInt32(bData, 4 * 16);
     mesObject.recivetime = nowtime;
     mesObject.sendtime = senddate + "" + sendtime;
     mesObject.mid = midhead + "" + midend;
     mesObject.networktype = networktype;
     mesObject.lac = lac;
     mesObject.cid = cid;
     mesObject.rsp = rsp;
     mesObject.s_x = sensor_x;
     mesObject.s_y = sensor_y;
     mesObject.s_z = sensor_z;
     mesObject.gps_x = gpsX_H / 100 + "°" + gpsX_H % 100 + "′" + gpsX_L / 100000 + "." + gpsX_L % 100000 + "″";
     mesObject.gps_y = gpsY_H / 100 + "°" + gpsY_H % 100 + "′" + gpsY_L / 100000 + "." + gpsY_L % 100000 + "″";
     mesObject.gps_h = gps_h;
     mesObject.gps_num = gps_num;
     return mesObject;
 }
Beispiel #3
0
 public SaveData(MesObject mso)
 {
     SaveLog(mso);
     SaveDB(mso);
 }
Beispiel #4
0
 private void SaveLog(MesObject mso)
 {
     UtilsLog uLog = new UtilsLog();
     uLog.WriteLog(mso.ToString(), mso.mid);
 }
Beispiel #5
0
 private void SaveDB(MesObject mso)
 {
     UtilsDB db = new UtilsDB();
     db.SaveDB();//暂无代码
 }