Ejemplo n.º 1
0
    private void PushReceivedPacket()
    {
        const int EMPTY_PACKET_SIZE   = 0;
        const int GITSHA1_PACKET_SIZE = 7;
        const int POSE_PACKET_SIZE    = 36;

        switch (_packet_size)
        {
        case EMPTY_PACKET_SIZE:
            return;

        case GITSHA1_PACKET_SIZE:
            _gitsha1 = _ascii.GetString(_inactive_buffer, 0, GITSHA1_PACKET_SIZE);
            return;

        case POSE_PACKET_SIZE:
            BicyclePose pose = new BicyclePose();
            pose.SetFromByteArray(_inactive_buffer);
            lock (_pose_lock) {
                _pose = pose;
            }
            return;

        default:
            Debug.Log(String.Format("Invalid packet size: {0}", ++_packet_error));
            break;
        }
    }