Beispiel #1
0
static void btpad_connection_send_control(void *data,
      uint8_t* data_buf, size_t size)
{
   struct btstack_hid_adapter *connection = (struct btstack_hid_adapter*)data;

   if (connection)
      bt_send_l2cap_ptr(connection->channels[0], data_buf, size);
}
Beispiel #2
0
static void btpad_ps3_setleds(struct btpad_ps3_data* device, unsigned leds)
{
   // TODO: Can this be modified to turn of motion tracking?
   static uint8_t report_buffer[] = {
      0x52, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00,
      0xff, 0x27, 0x10, 0x00, 0x32,
      0xff, 0x27, 0x10, 0x00, 0x32,
      0xff, 0x27, 0x10, 0x00, 0x32,
      0xff, 0x27, 0x10, 0x00, 0x32,
      0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
   };
   
   report_buffer[11] = (leds & 0xF) << 1;
   bt_send_l2cap_ptr(device->channels[0], report_buffer, sizeof(report_buffer));
}
Beispiel #3
0
static void* btpad_ps3_connect(const btpad_connection_t* connection)
{
   struct btpad_ps3_data* device = malloc(sizeof(struct btpad_ps3_data));
   memset(device, 0, sizeof(*device));

   memcpy(device->address, connection->address, BD_ADDR_LEN);
   device->handle = connection->handle;
   device->channels[0] = connection->channels[0];
   device->channels[1] = connection->channels[1];
   
   // Magic packet to start reports
   static uint8_t data[] = {0x53, 0xF4, 0x42, 0x03, 0x00, 0x00};
   bt_send_l2cap_ptr(device->channels[0], data, 6);

   // Without this the digital buttons won't be reported
   btpad_ps3_setleds(device, 1);

   return device;
}
Beispiel #4
0
void apple_pad_send_control(struct apple_pad_connection* connection, uint8_t* data, size_t size)
{
   bt_send_l2cap_ptr(connection->channels[0], data, size);
}