This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HID service makes phone lock screen? How to go about the development, is it a basic source project?

Based on nRF52 hardware,I want to develop a phone based on HID protocol to control the phone, send instructions to let the phone into the lock screen state,

How to go about the development, is it a basic source project?

Parents Reply
  • Hi Alan

    Now I feel a bit stupid. After looking at this again I realized you only have to make a very small change to the ble_app_hids_keyboard example in order to support this command. 

    The keyboard power command is treated like any other keypress, which means you can send it in the same way that you send any other keys. 

    All you have to change to support this is to change the Logical Maximum and the Usage Maximum of the key codes from 0x65 to 0x66:

    Once I made this change I updated the sample message to send the keyboard power command after typing "hello", instead of sending a newline:

    static uint8_t m_sample_key_press_scan_str[] = /**< Key pattern to be sent when the key press button has been pushed. */
    {
        0x0b,       /* Key h */
        0x08,       /* Key e */
        0x0f,       /* Key l */
        0x0f,       /* Key l */
        0x12,       /* Key o */
        0x66        /* Keyboard power */
    };

    Now if you press Button 1 on the DK it should first type out hello, and then it should put the phone to sleep. 

    I have added the full project here for your reference:

    270484_ble_app_hids_keyboard.zip

    Best regards
    Torbjørn

Children
Related