hci_cmd.c (067ecc364d8946158008b54f1e59f9128f2e967e) hci_cmd.c (bb75dd7da25e1501136b25b5fc034b04ddbb1380)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 125 unchanged lines hidden (view full) ---

134 (void)memcpy(&hci_cmd_buffer[pos], ptr, len);
135 if (len < 248u) {
136 // fill remaining space with zeroes
137 memset(&hci_cmd_buffer[pos+len], 0u, 248u-len);
138 }
139 pos += 248;
140 break;
141 }
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 125 unchanged lines hidden (view full) ---

134 (void)memcpy(&hci_cmd_buffer[pos], ptr, len);
135 if (len < 248u) {
136 // fill remaining space with zeroes
137 memset(&hci_cmd_buffer[pos+len], 0u, 248u-len);
138 }
139 pos += 248;
140 break;
141 }
142 case 'P': // 16 byte PIN code or link key
142 case 'P': // 16 byte PIN code or link key in little endian
143 ptr = va_arg(argptr, uint8_t *);
144 (void)memcpy(&hci_cmd_buffer[pos], ptr, 16);
145 pos += 16;
146 break;
147#ifdef ENABLE_BLE
148 case 'A': // 31 bytes advertising data
149 ptr = va_arg(argptr, uint8_t *);
150 (void)memcpy(&hci_cmd_buffer[pos], ptr, 31);

--- 11 unchanged lines hidden (view full) ---

162#endif
163#ifdef ENABLE_LE_SECURE_CONNECTIONS
164 case 'Q':
165 ptr = va_arg(argptr, uint8_t *);
166 reverse_bytes(ptr, &hci_cmd_buffer[pos], 32);
167 pos += 32;
168 break;
169#endif
143 ptr = va_arg(argptr, uint8_t *);
144 (void)memcpy(&hci_cmd_buffer[pos], ptr, 16);
145 pos += 16;
146 break;
147#ifdef ENABLE_BLE
148 case 'A': // 31 bytes advertising data
149 ptr = va_arg(argptr, uint8_t *);
150 (void)memcpy(&hci_cmd_buffer[pos], ptr, 31);

--- 11 unchanged lines hidden (view full) ---

162#endif
163#ifdef ENABLE_LE_SECURE_CONNECTIONS
164 case 'Q':
165 ptr = va_arg(argptr, uint8_t *);
166 reverse_bytes(ptr, &hci_cmd_buffer[pos], 32);
167 pos += 32;
168 break;
169#endif
170 case 'K': // 16 byte OOB Data or Link Key in big endian
171 ptr = va_arg(argptr, uint8_t *);
172 reverse_bytes(ptr, &hci_cmd_buffer[pos], 16);
173 pos += 16;
174 break;
170 default:
171 break;
172 }
173 format++;
174 };
175 hci_cmd_buffer[2] = pos - 3;
176 return pos;
177}

--- 226 unchanged lines hidden (view full) ---

404};
405
406/**
407 * @param bd_addr
408 * @param c Simple Pairing Hash C
409 * @param r Simple Pairing Randomizer R
410 */
411const hci_cmd_t hci_remote_oob_data_request_reply = {
175 default:
176 break;
177 }
178 format++;
179 };
180 hci_cmd_buffer[2] = pos - 3;
181 return pos;
182}

--- 226 unchanged lines hidden (view full) ---

409};
410
411/**
412 * @param bd_addr
413 * @param c Simple Pairing Hash C
414 * @param r Simple Pairing Randomizer R
415 */
416const hci_cmd_t hci_remote_oob_data_request_reply = {
412 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_REPLY, "BPP"
417 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_REPLY, "BKK"
413};
414
415/**
416 * @param bd_addr
417 */
418const hci_cmd_t hci_remote_oob_data_request_negative_reply = {
419 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY, "B"
420};

--- 78 unchanged lines hidden (view full) ---

499 * @param packet_type
500 * @param retransmission_effort
501 */
502const hci_cmd_t hci_enhanced_accept_synchronous_connection = {
503 HCI_OPCODE_HCI_ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION, "B4412212222441221222211111111221"
504};
505
506/**
418};
419
420/**
421 * @param bd_addr
422 */
423const hci_cmd_t hci_remote_oob_data_request_negative_reply = {
424 HCI_OPCODE_HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY, "B"
425};

--- 78 unchanged lines hidden (view full) ---

504 * @param packet_type
505 * @param retransmission_effort
506 */
507const hci_cmd_t hci_enhanced_accept_synchronous_connection = {
508 HCI_OPCODE_HCI_ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION, "B4412212222441221222211111111221"
509};
510
511/**
512 * @param bd_addr
513 * @param c_192 Simple Pairing Hash C derived from P-192 public key
514 * @param r_192 Simple Pairing Randomizer derived from P-192 public key
515 * @param c_256 Simple Pairing Hash C derived from P-256 public key
516 * @param r_256 Simple Pairing Randomizer derived from P-256 public key
517 */
518const hci_cmd_t hci_remote_oob_extended_data_request_reply = {
519 HCI_OPCODE_HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY, "BKKKK"
520};
521
522/**
507 * Link Policy Commands
508 */
509
510/**
511 * @param handle
512 * @param sniff_max_interval
513 * @param sniff_min_interval
514 * @param sniff_attempt

--- 332 unchanged lines hidden (view full) ---

847 */
848const hci_cmd_t hci_write_secure_connections_host_support = {
849 HCI_OPCODE_HCI_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT, "1"
850 // return: status
851};
852
853/**
854 */
523 * Link Policy Commands
524 */
525
526/**
527 * @param handle
528 * @param sniff_max_interval
529 * @param sniff_min_interval
530 * @param sniff_attempt

--- 332 unchanged lines hidden (view full) ---

863 */
864const hci_cmd_t hci_write_secure_connections_host_support = {
865 HCI_OPCODE_HCI_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT, "1"
866 // return: status
867};
868
869/**
870 */
855const hci_cmd_t hci_read_local_extended_ob_data = {
871const hci_cmd_t hci_read_local_extended_oob_data = {
856 HCI_OPCODE_HCI_READ_LOCAL_EXTENDED_OB_DATA, ""
857 // return status, C_192, R_192, R_256, C_256
858};
859
860
861/**
862 * Testing Commands
863 */

--- 676 unchanged lines hidden ---
872 HCI_OPCODE_HCI_READ_LOCAL_EXTENDED_OB_DATA, ""
873 // return status, C_192, R_192, R_256, C_256
874};
875
876
877/**
878 * Testing Commands
879 */

--- 676 unchanged lines hidden ---