Exemplo n.º 1
0
        void ProcessClient(Bluetooth.BluetoothClient client)
        {
            var stream = client.GetStream();

            while (true)
            {
                var buffer = new byte[Message.HeaderSize];
                if (stream.Read(buffer, 0, Message.HeaderSize) > 0 && isRunning)
                {
                    var message = new MessageInfo(buffer);
                    switch (message.Type)
                    {
                    case MessageType.MoveScreen:
                    case MessageType.MouseButton:
                    case MessageType.MouseWheel:
                    case MessageType.MouseMove:
                    case MessageType.KeyPress:
                        messages.Enqueue(message);
                        break;

                    case MessageType.Clipboard:
                        messages.Enqueue(MessagePacket.Parse(message, stream));
                        break;

                    case MessageType.CheckIn:
                        CheckInMessage checkIn = new CheckInMessage(MessagePacket.Parse(message, stream));
                        ScreenConfig(stream);
                        messages.Enqueue(checkIn);
                        break;
                    }
                    messageHandle.Set();
                }
            }
        }
Exemplo n.º 2
0
        void ProcessClient(Bluetooth.BluetoothClient client)
        {
            var stream = client.GetStream();

            while (true)
            {
                var buffer = new byte[Message.HeaderSize];
                if (stream.Read(buffer, 0, Message.HeaderSize) > 0 && isRunning)
                {
                    switch ((MessageType)(buffer[0] & Message.TypeMask))
                    {
                    case MessageType.MoveScreen:
                        break;

                    case MessageType.MouseWheel:
                        OnMouseWheelFromServer(buffer);
                        break;

                    case MessageType.MouseButton:
                        OnMouseButtonFromServer(buffer);
                        break;

                    case MessageType.MouseMove:
                        OnMouseMoveFromServer(buffer);
                        break;

                    case MessageType.KeyPress:
                        OnKeyPressFromServer(buffer);
                        break;

                    case MessageType.Clipboard:
                        OnClipboardFromServer(new ClipboardMessage(MessagePacket.Parse(new MessageInfo(buffer), stream)));
                        break;

                    case MessageType.CheckIn:
                        CheckInMessage checkIn = new CheckInMessage(MessagePacket.Parse(new MessageInfo(buffer), stream));
                        ScreenConfig(stream);
                        OnScreenConfig(checkIn.Screens);
                        break;
                    }
                }
            }
        }
 public ConnectedClient(Bluetooth.BluetoothClient client)
 {
     this.client = client;
 }