mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-19 16:21:06 +00:00
add const to hci_cmd_t for bt_send_cmd, too. Add C++ link protection to public headers
This commit is contained in:
parent
fe35119d8a
commit
df33c7a6dc
@ -46,6 +46,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Default TCP port for BTstack daemon
|
||||
#define BTSTACK_PORT 13333
|
||||
|
||||
@ -66,7 +70,7 @@ int bt_open();
|
||||
int bt_close();
|
||||
|
||||
// send hci cmd packet
|
||||
int bt_send_cmd(hci_cmd_t *cmd, ...);
|
||||
int bt_send_cmd(const hci_cmd_t *cmd, ...);
|
||||
|
||||
// register packet handler -- channel only valid for l2cap and rfcomm packets
|
||||
// @returns old packet handler
|
||||
@ -75,3 +79,7 @@ btstack_packet_handler_t bt_register_packet_handler(btstack_packet_handler_t han
|
||||
void bt_send_acl(uint8_t * data, uint16_t len);
|
||||
|
||||
void bt_send_l2cap(uint16_t local_cid, uint8_t *data, uint16_t len);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -39,6 +39,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* packet types - used in BTstack and over the H4 UART interface
|
||||
*/
|
||||
@ -243,3 +247,6 @@ extern const hci_cmd_t sdp_register_service_record;
|
||||
extern const hci_cmd_t sdp_unregister_service_record;
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -37,6 +37,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct linked_item {
|
||||
struct linked_item *next; // <-- next element in list, or NULL
|
||||
void *user_data; // <-- pointer to struct base
|
||||
@ -51,4 +55,8 @@ void linked_list_add(linked_list_t * list, linked_item_t *item); // <-- a
|
||||
void linked_list_add_tail(linked_list_t * list, linked_item_t *item); // <-- add item to list as last element
|
||||
int linked_list_remove(linked_list_t * list, linked_item_t *item); // <-- remove item from list
|
||||
|
||||
void test_linked_list();
|
||||
void test_linked_list();
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
RUN_LOOP_POSIX = 1,
|
||||
RUN_LOOP_COCOA,
|
||||
@ -75,3 +79,8 @@ int run_loop_remove_timer(timer_source_t *timer);
|
||||
|
||||
// execute configured run_loop
|
||||
void run_loop_execute();
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -37,6 +37,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
DE_NIL = 0,
|
||||
DE_UINT,
|
||||
@ -98,4 +102,8 @@ int de_get_data_size(uint8_t * header);
|
||||
#pragma mark SDP
|
||||
int sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startIndex, uint16_t maxBytes, uint8_t *buffer);
|
||||
uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID);
|
||||
int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
|
||||
int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief hci connection handle type
|
||||
*/
|
||||
@ -104,3 +108,8 @@ uint8_t crc8_calc(uint8_t *data, uint16_t len);
|
||||
#ifdef EMBEDDED
|
||||
void bzero(void *s, uint32_t n);
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -92,7 +92,7 @@ int bt_close(){
|
||||
}
|
||||
|
||||
// send hci cmd packet
|
||||
int bt_send_cmd(hci_cmd_t *cmd, ...){
|
||||
int bt_send_cmd(const hci_cmd_t *cmd, ...){
|
||||
va_list argptr;
|
||||
va_start(argptr, cmd);
|
||||
uint16_t len = hci_create_cmd_internal(hci_cmd_buffer, cmd, argptr);
|
||||
|
@ -208,7 +208,7 @@ typedef struct {
|
||||
|
||||
// create and send hci command packets based on a template and a list of parameters
|
||||
uint16_t hci_create_cmd(uint8_t *hci_cmd_buffer, hci_cmd_t *cmd, ...);
|
||||
uint16_t hci_create_cmd_internal(uint8_t *hci_cmd_buffer, hci_cmd_t *cmd, va_list argptr);
|
||||
uint16_t hci_create_cmd_internal(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr);
|
||||
|
||||
// set up HCI
|
||||
void hci_init(hci_transport_t *transport, void *config, bt_control_t *control);
|
||||
@ -223,7 +223,7 @@ int hci_power_control(HCI_POWER_MODE mode);
|
||||
void hci_run();
|
||||
|
||||
// create and send hci command packets based on a template and a list of parameters
|
||||
int hci_send_cmd(hci_cmd_t *cmd, ...);
|
||||
int hci_send_cmd(const hci_cmd_t *cmd, ...);
|
||||
|
||||
// send complete CMD packet
|
||||
int hci_send_cmd_packet(uint8_t *packet, int size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user