hryamzik / Bluetooth-Keyboard-Emulator

Swift Bluetooth HID Keyboard Emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluetooth Keyboard Emulator

Swift Bluetooth HID Keyboard Emulator

Open sourced from the Keyboard Connect project. The following sample shows how to publish a HID Bluetooth keyboard service.

How to Use

  • Run the Xcode project

From your phone/tablet:

  • Go to Bluetooth settings
  • If already paired with desktop, then "Forget the Device"
  • Connect to your dekstop.
  • Start Typing!

Source Files

  • BTKeyboard.swift

    Creates a Bluetooth SDP service using SerialPortDictionary.plist and listens for incoming connections.

  • KeyCodes.swift

    Converts virtual key codes (the number assigned to keys according NSEvent) to HID key codes (as specified in the USB specification).

  • AppDelegate.swift

    Initializes BTKeyboard then uses CGEventTap to get keyboard events and send them to the connected Bluetooth device.

  • SerialPortDictionary.plist

    A service record with a Human Interface Device Profile (HID). The HID profile describes a keyboard and the report used is outlined in HIDReportDescriptor.txt

  • HIDReportDescriptor.txt

    The parsed HIDReportDescriptor outlines how the bytes are described for a generic keyboard.

About

Swift Bluetooth HID Keyboard Emulator

License:The Unlicense


Languages

Language:Swift 100.0%