Open arunmagesh opened 6 years ago
`// Copyright (c) Sandeep Mistry. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import libraries (BLEPeripheral depends on SPI)
//#define ANDROID_CENTRAL
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST) BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(); BLEKeyboard bleKeyboard;
void setup() { Serial.begin(9600);
while(!Serial);
// clear bond store data bleHIDPeripheral.clearBondStoreData();
bleHIDPeripheral.setReportIdOffset(1);
bleHIDPeripheral.setLocalName("HID Keyboard"); bleHIDPeripheral.addHID(bleKeyboard);
bleHIDPeripheral.begin();
Serial.println(F("BLE HID Keyboard")); }
void loop() { BLECentral central = bleHIDPeripheral.central();
if (central) { // central connected to peripheral Serial.print(F("Connected to central: ")); Serial.println(central.address());
while (central.connected()) {
{
bleKeyboard.print("TESTING");
}
}
// central disconnected
Serial.print(F("Disconnected from central: "));
Serial.println(central.address());
} }`
I have exactly the same problem. Did you solve the issue ?
I experienced this issue under macOS. The sample code worked for Android. The sample code is however not a complete compliant BLE HID device. There is a lot of stuff missing (Battery Serivce, Device Information, …) which I added manually and finally got it working. I haven't figures out yet what the minimum set of services/characteristics is that macOS accepts as a valid input device.
I've also noticed that there is still some things with the bond store: I need to remove the BLE device from macOS and reconnect to make it work. I believe the storing keys to the bond store does not quite work right for me currently. When macOS re-connects the device does not have the correct keys. After removing the device from macOS and re-bonding everythings works again.
I experienced this issue under macOS. The sample code worked for Android. The sample code is however not a complete compliant BLE HID device. There is a lot of stuff missing (Battery Serivce, Device Information, …) which I added manually and finally got it working. I haven't figures out yet what the minimum set of services/characteristics is that macOS accepts as a valid input device.
I've also noticed that there is still some things with the bond store: I need to remove the BLE device from macOS and reconnect to make it work. I believe the storing keys to the bond store does not quite work right for me currently. When macOS re-connects the device does not have the correct keys. After removing the device from macOS and re-bonding everythings works again.
Hi, can you share your working sketch with those added characteristics? Thanks!
Hey!
No, I haven't kept the code I don't think. It's pretty easy though.
I tried changing many settings about those characteristics but I can't find any combination that works correctly. The NRF51 is seen correctly as a keyboard but can't send any keystroke; furthermore the device can't be edited on Android (settings like keyboard layout, where usually you can with commercial keyboards), seems like it's missing some sort of security or mandatory characteristic to be recognized as a trustable HID device. If you can help me retrieve this sketch or figure out how it was working for you it will be amazing. Still thanks
Hello, I have flashed my nrf518xxaa module with s130.
Whenever I flash HID keyboard or mouse. it just broadcasts and connects and the keystrokes are not actually passed to the device. i can see all the HID serv and charac in nrf tools .
What could be wrong??