private byte[] createADCSFrame()
        {
            fadcs.adcs.velox = (float)1.2;                        //1
            fadcs.adcs.posix = (float)123.45;                     //2

            return(UniSerialize.StructToByte((SATFRAMEADCS)fadcs));
        }
Beispiel #2
0
        public DataTable ParseMessage(byte[] bvals)
        {
            entireBytes = getEntirePackage(bvals);  //获取完整的帧

            if (entireBytes == null)
            {
                return(null);
            }

            tyPack = (TianYuanPackage)UniSerialize.ByteToStruct(entireBytes, tyPack.GetType());

            return(getHouseKeepingPackage(getsatFrameBytes()));

            //byte[]
            //return new DataTable();
        }
        private byte[] createOBCFrame()
        {
            fobc.pl.soft_id      = 0x55;                                  //1
            fobc.pl.reboot_count = 0x01;                                  //2

            fobc.pl.rec_cmd_count = recCNT;                               //2
            fobc.pl.down_count    = downCNT;                              //2

            fobc.pl.last_reset_time = 0;                                  //4
            fobc.pl.work_mode       = 0x10;                               //1

            fobc.pl.utc_time = UniFunction.xDateSeconds(DateTime.UtcNow); //4
            fobc.pl.temp_hk  = -27;                                       //2

            fobc.pl.on_off_status = 0xAA55AA55;                           //4
            fobc.pl.batt_TEMP1    = 27;                                   //2



            byte[] bval = UniSerialize.StructToByte((PlatForm)fobc.pl);

            bval.CopyTo(typk.frame, 0);

            typk.epdu.length = (ushort)bval.Length;

            byte[] bval2 = UniSerialize.StructToByte((TianYuanPackage)typk);

            //string str = Encoding.ASCII.GetString(bval);
            //string str = "";
            //foreach(byte b in bval)
            //{
            //    str += "0x" + b.ToString("X2") + "\t";
            //}
            //str += "\n";
            //Trace.WriteLine("", "");
            //Trace.WriteLine("", str);
            //Trace.WriteLine("", "");
            return(bval2);
        }