public override void Deserialize(byte[] data)
        {
            BitArray8 status = new BitArray8();

            status.aByte = data[1];

            hero_connected      = status.GetBit(0);
            vision_connected    = status.GetBit(1);
            dashboard_connected = status.GetBit(2);
            realsense_connected = status.GetBit(3);
            tcpserial_connected = status.GetBit(4);
        }
Esempio n. 2
0
        public override byte[] Serialize()
        {
            byte[] ret = new byte[CommunicationStandards.CommunicationDefinitions.PACKET_SIZES[CommunicationStandards.CommunicationDefinitions.TYPE.JOYSTICK] + 1];

            ret[TYPE_OFFSET] = TYPE;


            BitArray8 button_data_1 = new BitArray8();
            BitArray8 button_data_2 = new BitArray8();

            button_data_1.SetBit(0, button_a);
            button_data_1.SetBit(1, button_b);
            button_data_1.SetBit(2, button_x);
            button_data_1.SetBit(3, button_y);
            button_data_1.SetBit(4, button_lb);
            button_data_1.SetBit(5, button_rb);
            button_data_1.SetBit(6, button_start);
            button_data_1.SetBit(7, button_select);

            button_data_2.SetBit(0, button_lj);
            button_data_2.SetBit(1, button_rj);
            button_data_2.SetBit(2, pov_u);
            button_data_2.SetBit(3, pov_r);
            button_data_2.SetBit(4, pov_d);
            button_data_2.SetBit(5, pov_l);

            ret[BUTTONS_1_OFFSET] = button_data_1.aByte;
            ret[BUTTONS_2_OFFSET] = button_data_2.aByte;

            ret[LJ_X_OFFSET] = lj_x;
            ret[LJ_Y_OFFSET] = lj_y;
            ret[RJ_X_OFFSET] = rj_x;
            ret[RJ_Y_OFFSET] = rj_y;
            ret[LT_OFFSET]   = lt;
            ret[RT_OFFSET]   = rt;

            return(ret);
        }