HI experts
I have a nRF51-DK board. I have flashed it with S130 softdevice. I have also flashed it with BLE_APP_HIDS_KEYBOARD application example. I have made little change in source code.
I see that
hello string is defined in
static uint8_t m_sample_key_press_scan_str[] = /**< Key pattern to be sent when the key
press button has been pushed. */
{
0x0f, /* Key h */
0x0c, /* Key e */
0x13, /* Key l */
0x0f, /* Key l */
0x37, /* Key o */
0x2b /* Key Return */
};
i changed this code with
#define KEY_1 0x1e // Keyboard 1 and !
#define KEY_2 0x1f // Keyboard 2 and @
#define KEY_3 0x20 // Keyboard 3 and #
#define KEY_4 0x21 // Keyboard 4 and $
#define KEY_5 0x22 // Keyboard 5 and %
#define KEY_6 0x23 // Keyboard 6 and ^
#define KEY_7 0x24 // Keyboard 7 and &
#define KEY_8 0x25 // Keyboard 8 and *
#define KEY_9 0x26 // Keyboard 9 and (
#define KEY_0 0x27 // Keyboard 0 and )
static uint8_t m_sample_key_press_scan_str[] = /**< Key pattern to be sent when the key
press button has been pushed. */
{
KEY_1;
KEY_2;
KEY_3;
KEY_4;
KEY_5;
0x2b /* Key Return */
};
and also made changes in key press event
case BSP_EVENT_KEY_0:
{
if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
{
keys_send(1, p_key);
//p_key++;
size++;
keys_send(1, (p_key+1));
//p_key++;
size++;
keys_send(1, (p_key+2));
//p_key++;
size++;
keys_send(1, (p_key+3));
//p_key++;
size++;
keys_send(1, (p_key+4));
//p_key++;
size++;
keys_send(1, (p_key+5));
//p_key++;
size++;
if (size == MAX_KEYS_IN_ONE_REPORT)
{
p_key = m_sample_key_press_scan_str;
size = 0;
}
}
}
break;
i have modified above code to send multiple characters with single button press.In original source code provided by nordic, only one character is sent on single button press. rest everything is as kept as it is.
After making changes the expected string is
12345
this string is coming alright on i OS 10 devices. I have tested this with iPhone 5. when i started testing with android devices (google pixel) i noticed strange behavior. Sting received on android device is
12345555 (last character repeats itself random number of times).
I am unable to understand why. Can some one help me understanding this.