rfcomm.h (31a592581c0f53871459d1a600ee64c782263cb6) | rfcomm.h (a7a98a14513a32bb8a1b7d8f69d92f3c9f0b8988) |
---|---|
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 --- 166 unchanged lines hidden (view full) --- 175 uint16_t max_frame_size; 176 177 // send DM for DLCI != 0 178 uint8_t send_dm_for_dlci; 179 180 // non supported command, 0 if not set 181 uint8_t nsc_command; 182 | 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 --- 166 unchanged lines hidden (view full) --- 175 uint16_t max_frame_size; 176 177 // send DM for DLCI != 0 178 uint8_t send_dm_for_dlci; 179 180 // non supported command, 0 if not set 181 uint8_t nsc_command; 182 |
183 // ertm id 184 uint16_t ertm_id; 185 |
|
183 // test data - limited to RFCOMM_TEST_DATA_MAX_LEN 184 uint8_t test_data_len; 185 uint8_t test_data[RFCOMM_TEST_DATA_MAX_LEN]; 186 187} rfcomm_multiplexer_t; 188 189// info regarding an actual connection 190typedef struct { --- 49 unchanged lines hidden (view full) --- 240 // msc modem status. 241 uint8_t msc_modem_status; 242 243 // 244 uint8_t waiting_for_can_send_now; 245 246} rfcomm_channel_t; 247 | 186 // test data - limited to RFCOMM_TEST_DATA_MAX_LEN 187 uint8_t test_data_len; 188 uint8_t test_data[RFCOMM_TEST_DATA_MAX_LEN]; 189 190} rfcomm_multiplexer_t; 191 192// info regarding an actual connection 193typedef struct { --- 49 unchanged lines hidden (view full) --- 243 // msc modem status. 244 uint8_t msc_modem_status; 245 246 // 247 uint8_t waiting_for_can_send_now; 248 249} rfcomm_channel_t; 250 |
251// struct used in ERTM callback 252typedef struct { 253 // remote address 254 bd_addr_t addr; 255 256 // ERTM ID - returned in RFCOMM_EVENT_ERTM_BUFFER_RELEASED. 257 uint16_t ertm_id; 258 259 // ERTM Configuration - needs to stay valid indefinitely 260 l2cap_ertm_config_t * ertm_config; 261 262 // ERTM buffer 263 uint8_t * ertm_buffer; 264 uint32_t ertm_buffer_size; 265} rfcomm_ertm_request_t; 266 |
|
248/* API_START */ 249 250/** 251 * @brief Set up RFCOMM. 252 */ 253void rfcomm_init(void); 254 255/** --- 134 unchanged lines hidden (view full) --- 390 * rfcomm_send_prepared(cid, len) 391 * } 392 */ 393int rfcomm_reserve_packet_buffer(void); 394uint8_t * rfcomm_get_outgoing_buffer(void); 395int rfcomm_send_prepared(uint16_t rfcomm_cid, uint16_t len); 396void rfcomm_release_packet_buffer(void); 397 | 267/* API_START */ 268 269/** 270 * @brief Set up RFCOMM. 271 */ 272void rfcomm_init(void); 273 274/** --- 134 unchanged lines hidden (view full) --- 409 * rfcomm_send_prepared(cid, len) 410 * } 411 */ 412int rfcomm_reserve_packet_buffer(void); 413uint8_t * rfcomm_get_outgoing_buffer(void); 414int rfcomm_send_prepared(uint16_t rfcomm_cid, uint16_t len); 415void rfcomm_release_packet_buffer(void); 416 |
417/** 418 * @brief Enable L2CAP ERTM mode for RFCOMM. request callback is used to provide ERTM buffer. released callback returns buffer 419 * 420 * @note on request_callback, the app must set the ertm_config, buffer, size fields to enable ERTM for the current connection 421 * @note if buffer is not set, BASIC mode will be used instead 422 * 423 * @note released_callback provides ertm_id from earlier request to match request and release 424 * 425 * @param request_callback 426 * @param released_callback 427 */ 428void rfcomm_enable_l2cap_ertm(void request_callback(rfcomm_ertm_request_t * request), void released_callback(uint16_t ertm_id)); 429 |
|
398/* API_END */ 399 400#if defined __cplusplus 401} 402#endif 403 404#endif // __RFCOMM_H | 430/* API_END */ 431 432#if defined __cplusplus 433} 434#endif 435 436#endif // __RFCOMM_H |