Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            InitControlProperty();
            PB2010 pb2010 = new PB2010();

            Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(pb2010)); //to know struct length
        }
Esempio n. 2
0
        private void OnReceiveData(object sender, long requestID, ushort dataType, byte[] body)
        {
            switch (dataType)
            {
            case 2001:
                PB2001 pb2001 = new PB2001();
                pb2001 = (PB2001)BytesToStruct(body, pb2001.GetType());
                AddInfo(pb2001.toLog());
                break;

            case 2002:
                PB2002 pb2002 = new PB2002();
                pb2002.toData(body);
                AddInfo(pb2002.toLog());
                break;

            case 2010:
                PB2010 pb2010 = new PB2010();
                pb2010.toData(body);
                AddInfo(pb2010.toLog());
                break;

            default:
                string smsg = encoding.GetString(body);
                AddInfo("Received Data Type=" + dataType.ToString() + "|Data" + smsg);
                break;
            }
            push.Processed();
        }