123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- #ifndef BLE_IPSP_H__
- #define BLE_IPSP_H__
- #include <stdint.h>
- #include "ble.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define BLE_IPSP_MAX_CHANNELS 1
- #define BLE_IPSP_MTU 1280
- #define BLE_IPSP_RX_MPS 50
- #define BLE_IPSP_TX_MPS 212
- #define BLE_IPSP_RX_BUFFER_SIZE 1280
- #define BLE_IPSP_RX_BUFFER_COUNT 4
- #define BLE_IPSP_PSM 0x0023
- typedef enum
- {
- BLE_IPSP_EVT_CHANNEL_CONNECTED,
- BLE_IPSP_EVT_CHANNEL_DISCONNECTED,
- BLE_IPSP_EVT_CHANNEL_DATA_RX,
- BLE_IPSP_EVT_CHANNEL_DATA_TX_COMPLETE
- } ble_ipsp_evt_type_t;
- typedef struct
- {
- ble_l2cap_evt_t const * p_l2cap_evt;
- ble_gap_addr_t const * p_peer;
- } ble_ipsp_event_param_t;
- typedef struct
- {
- ble_ipsp_evt_type_t evt_id;
- ble_ipsp_event_param_t * p_evt_param;
- uint32_t evt_result;
- } ble_ipsp_evt_t;
- typedef struct
- {
- uint16_t conn_handle;
- uint16_t cid;
- } ble_ipsp_handle_t;
- typedef uint32_t (*ble_ipsp_evt_handler_t) (ble_ipsp_handle_t const * p_handle,
- ble_ipsp_evt_t const * p_evt);
- typedef struct
- {
- ble_ipsp_evt_handler_t evt_handler;
- } ble_ipsp_init_t;
- uint32_t ble_ipsp_init(ble_ipsp_init_t const * p_init);
- uint32_t ble_ipsp_connect(ble_ipsp_handle_t const * p_handle);
- uint32_t ble_ipsp_send(ble_ipsp_handle_t const * p_handle,
- uint8_t const * p_data,
- uint16_t data_len);
- uint32_t ble_ipsp_disconnect(ble_ipsp_handle_t const * p_handle);
-
- void ble_ipsp_incoming_channel_accept(uint16_t conn_handle);
- void ble_ipsp_incoming_channel_reject(uint16_t conn_handle);
- void ble_ipsp_evt_handler(ble_evt_t const * p_evt);
- #ifdef __cplusplus
- }
- #endif
- #endif
|