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

how can I send a media button data with hid_mouse_demo ?

BLE button and movement function seems ok now. How can I send media function like AC Forward or AC Back ?

    // Report ID 3: Advanced buttons
    0x05, 0x0C,                     // Usage Page (Consumer)
    0x09, 0x01,                     // Usage (Consumer Control) 
    0xA1, 0x01,                     // Collection (Application)
    0x85, 0x03,                     //     Report Id (3) 
    0x15, 0x00,                     //     Logical minimum (0)
    0x25, 0x01,                     //     Logical maximum (1) 
    0x75, 0x01,                     //     Report Size (1)
   *0x95, 0x01,                     //     Report Count (1)  // this should change to 0x95   ,0x08 , right?*

    0x09, 0xCD,                     //     Usage (Play/Pause) 
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field)
    0x0A, 0x83, 0x01,               //     Usage (AL Consumer Control Configuration) 
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field)
    0x09, 0xB5,                     //     Usage (Scan Next Track)
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field)   
    0x09, 0xB6,                     //     Usage (Scan Previous Track)
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field) 

    0x09, 0xEA,                     //     Usage (Volume Down)
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field) 
    0x09, 0xE9,                     //     Usage (Volume Up) 
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field) 
    0x0A, 0x25, 0x02,               //     Usage (AC Forward) 
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field) 
    0x0A, 0x24, 0x02,               //     Usage (AC Back) 
    0x81, 0x06,                     //     Input (Data,Value,Relative,Bit Field) 
    0xC0                            // End Collection

when I send data by func below, is does't work , need your help. Thank you.

mouse_media_send(0x1); nrf_delay_ms(5); mouse_media_send(0x0);

static void mouse_media_send(uint8_t bMedia)
{
	uint32_t err_code;  
    
	if (m_in_boot_mode) {
		
		
	} else {
		
        uint8_t buffer[INPUT_REP_MEDIA_PLAYER_LEN];
        
        APP_ERROR_CHECK_BOOL(INPUT_REP_MEDIA_PLAYER_LEN == 1);

        buffer[0] = bMedia;
        
        err_code = ble_hids_inp_rep_send(&m_hids,
                                         INPUT_REP_MPLAYER_INDEX, 
                                         INPUT_REP_MEDIA_PLAYER_LEN, 
                                         buffer);	
	}
	
	if (
        (err_code != NRF_SUCCESS)
        &&
        (err_code != NRF_ERROR_INVALID_STATE)
        &&
        (err_code != BLE_ERROR_NO_TX_BUFFERS)
        &&
        (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
	)
	
	{
        APP_ERROR_HANDLER(err_code);
	}
}
Related