Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_bt_serial_le.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /** |
lypinator | 0:bb348c97df44 | 2 | *--------------------------------------------------------------------------- |
lypinator | 0:bb348c97df44 | 3 | * Copyright (c) 2016, u-blox Malmö, All Rights Reserved |
lypinator | 0:bb348c97df44 | 4 | * SPDX-License-Identifier: LicenseRef-PBL |
lypinator | 0:bb348c97df44 | 5 | * |
lypinator | 0:bb348c97df44 | 6 | * This file and the related binary are licensed under the |
lypinator | 0:bb348c97df44 | 7 | * Permissive Binary License, Version 1.0 (the "License"); |
lypinator | 0:bb348c97df44 | 8 | * you may not use these files except in compliance with the License. |
lypinator | 0:bb348c97df44 | 9 | * |
lypinator | 0:bb348c97df44 | 10 | * You may obtain a copy of the License here: |
lypinator | 0:bb348c97df44 | 11 | * LICENSE-permissive-binary-license-1.0.txt and at |
lypinator | 0:bb348c97df44 | 12 | * https://www.mbed.com/licenses/PBL-1.0 |
lypinator | 0:bb348c97df44 | 13 | * |
lypinator | 0:bb348c97df44 | 14 | * See the License for the specific language governing permissions and |
lypinator | 0:bb348c97df44 | 15 | * limitations under the License. |
lypinator | 0:bb348c97df44 | 16 | * |
lypinator | 0:bb348c97df44 | 17 | * Component : Bluetooth Serial |
lypinator | 0:bb348c97df44 | 18 | * File : cb_bt_serial_le.h |
lypinator | 0:bb348c97df44 | 19 | * |
lypinator | 0:bb348c97df44 | 20 | * Description : Data management for Serial Port Service. |
lypinator | 0:bb348c97df44 | 21 | * |
lypinator | 0:bb348c97df44 | 22 | *-------------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 23 | |
lypinator | 0:bb348c97df44 | 24 | /** |
lypinator | 0:bb348c97df44 | 25 | * @file cb_bt_serial_le.h |
lypinator | 0:bb348c97df44 | 26 | * @brief Data management for Serial Port Service. |
lypinator | 0:bb348c97df44 | 27 | */ |
lypinator | 0:bb348c97df44 | 28 | |
lypinator | 0:bb348c97df44 | 29 | #ifndef _CB_BT_SERIAL_LE_H_ |
lypinator | 0:bb348c97df44 | 30 | #define _CB_BT_SERIAL_LE_H_ |
lypinator | 0:bb348c97df44 | 31 | |
lypinator | 0:bb348c97df44 | 32 | #include "cb_comdefs.h" |
lypinator | 0:bb348c97df44 | 33 | #include "bt_types.h" |
lypinator | 0:bb348c97df44 | 34 | #include "cb_bt_conn_man.h" |
lypinator | 0:bb348c97df44 | 35 | |
lypinator | 0:bb348c97df44 | 36 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 37 | extern "C" { |
lypinator | 0:bb348c97df44 | 38 | #endif |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 41 | * DEFINES |
lypinator | 0:bb348c97df44 | 42 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 43 | #define cbBSL_OK 0 |
lypinator | 0:bb348c97df44 | 44 | #define cbBSL_ERROR -1 |
lypinator | 0:bb348c97df44 | 45 | #define cbBSL_NO_DATA -2 |
lypinator | 0:bb348c97df44 | 46 | |
lypinator | 0:bb348c97df44 | 47 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 48 | * TYPES |
lypinator | 0:bb348c97df44 | 49 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 50 | |
lypinator | 0:bb348c97df44 | 51 | typedef void (*cbBSL_DataAvailEvt)( |
lypinator | 0:bb348c97df44 | 52 | cbBCM_Handle handle); |
lypinator | 0:bb348c97df44 | 53 | |
lypinator | 0:bb348c97df44 | 54 | typedef void (*cbBSL_WriteCnf)( |
lypinator | 0:bb348c97df44 | 55 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 56 | cb_int32 status, |
lypinator | 0:bb348c97df44 | 57 | cb_uint32 nBytes, |
lypinator | 0:bb348c97df44 | 58 | cb_int32 tag); |
lypinator | 0:bb348c97df44 | 59 | |
lypinator | 0:bb348c97df44 | 60 | typedef struct |
lypinator | 0:bb348c97df44 | 61 | { |
lypinator | 0:bb348c97df44 | 62 | cbBSL_DataAvailEvt pfDataEvt; |
lypinator | 0:bb348c97df44 | 63 | cbBSL_WriteCnf pfWriteCnf; |
lypinator | 0:bb348c97df44 | 64 | } cbBSL_Callback; |
lypinator | 0:bb348c97df44 | 65 | |
lypinator | 0:bb348c97df44 | 66 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 67 | * FUNCTIONS |
lypinator | 0:bb348c97df44 | 68 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 69 | |
lypinator | 0:bb348c97df44 | 70 | /** |
lypinator | 0:bb348c97df44 | 71 | * Initialization of Bluetooth serial manager. Called during stack |
lypinator | 0:bb348c97df44 | 72 | * initialization. Shall not be called by application. |
lypinator | 0:bb348c97df44 | 73 | * |
lypinator | 0:bb348c97df44 | 74 | * @return None |
lypinator | 0:bb348c97df44 | 75 | */ |
lypinator | 0:bb348c97df44 | 76 | extern void cbBSL_init(void); |
lypinator | 0:bb348c97df44 | 77 | |
lypinator | 0:bb348c97df44 | 78 | /** |
lypinator | 0:bb348c97df44 | 79 | * Open a data channel. |
lypinator | 0:bb348c97df44 | 80 | * |
lypinator | 0:bb348c97df44 | 81 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 82 | * @param pCallback Callback for data events. |
lypinator | 0:bb348c97df44 | 83 | * @return If the operation is successful cbBSL_OK is returned. |
lypinator | 0:bb348c97df44 | 84 | */ |
lypinator | 0:bb348c97df44 | 85 | extern cb_int32 cbBSL_open( |
lypinator | 0:bb348c97df44 | 86 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 87 | cbBSL_Callback *pCallback); |
lypinator | 0:bb348c97df44 | 88 | |
lypinator | 0:bb348c97df44 | 89 | /** |
lypinator | 0:bb348c97df44 | 90 | * Send data to remote device. A data confirmation event is generated when |
lypinator | 0:bb348c97df44 | 91 | * the data has been sent and a cbBSL_write call can be done. |
lypinator | 0:bb348c97df44 | 92 | * |
lypinator | 0:bb348c97df44 | 93 | * Detailed description optionally verbose. |
lypinator | 0:bb348c97df44 | 94 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 95 | * @param pBuf Data pointer |
lypinator | 0:bb348c97df44 | 96 | * @param nBytes nBytes Size of data to be sent. |
lypinator | 0:bb348c97df44 | 97 | * @param tag Tag passed as argument in corresponding data confirmation callback. |
lypinator | 0:bb348c97df44 | 98 | * @return If the operation is successful cbBSL_OK is returned. |
lypinator | 0:bb348c97df44 | 99 | */ |
lypinator | 0:bb348c97df44 | 100 | extern cb_int32 cbBSL_write( |
lypinator | 0:bb348c97df44 | 101 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 102 | cb_uint8 *pBuf, |
lypinator | 0:bb348c97df44 | 103 | cb_uint32 nBytes, |
lypinator | 0:bb348c97df44 | 104 | cb_int32 tag); |
lypinator | 0:bb348c97df44 | 105 | |
lypinator | 0:bb348c97df44 | 106 | /** |
lypinator | 0:bb348c97df44 | 107 | * Get received data. |
lypinator | 0:bb348c97df44 | 108 | * |
lypinator | 0:bb348c97df44 | 109 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 110 | * @param ppBuf Pointer to data buffer |
lypinator | 0:bb348c97df44 | 111 | * @param pLength Pointer to buffer length variable. |
lypinator | 0:bb348c97df44 | 112 | * @return cbBSL_OK is returned if data is available. If no data is available |
lypinator | 0:bb348c97df44 | 113 | * then cbBSL_NO_DATA is returned. |
lypinator | 0:bb348c97df44 | 114 | */ |
lypinator | 0:bb348c97df44 | 115 | extern cb_int32 cbBSL_getReadBuf( |
lypinator | 0:bb348c97df44 | 116 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 117 | cb_uint8 **ppBuf, |
lypinator | 0:bb348c97df44 | 118 | cb_uint32 *pLength); |
lypinator | 0:bb348c97df44 | 119 | |
lypinator | 0:bb348c97df44 | 120 | /** |
lypinator | 0:bb348c97df44 | 121 | * Notify that received data has been handled and underlying buffers |
lypinator | 0:bb348c97df44 | 122 | * can be freed. |
lypinator | 0:bb348c97df44 | 123 | * |
lypinator | 0:bb348c97df44 | 124 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 125 | * @param nBytes Number of bytes consumed. |
lypinator | 0:bb348c97df44 | 126 | * @return If the operation is successful cbBSL_OK is returned. |
lypinator | 0:bb348c97df44 | 127 | */ |
lypinator | 0:bb348c97df44 | 128 | extern cb_int32 cbBSL_readBufConsumed( |
lypinator | 0:bb348c97df44 | 129 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 130 | cb_uint32 nBytes); |
lypinator | 0:bb348c97df44 | 131 | |
lypinator | 0:bb348c97df44 | 132 | /** |
lypinator | 0:bb348c97df44 | 133 | * Read max frame size for a data channel. |
lypinator | 0:bb348c97df44 | 134 | * |
lypinator | 0:bb348c97df44 | 135 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 136 | * @param pFrameSize Max frame size for connection. |
lypinator | 0:bb348c97df44 | 137 | * @return If the operation is successful cbBSE_OK is returned. |
lypinator | 0:bb348c97df44 | 138 | */ |
lypinator | 0:bb348c97df44 | 139 | extern cb_int32 cbBSL_frameSize(cbBCM_Handle handle, cb_uint32 *pFrameSize); |
lypinator | 0:bb348c97df44 | 140 | |
lypinator | 0:bb348c97df44 | 141 | /** |
lypinator | 0:bb348c97df44 | 142 | * Bluetooth serial message handling. Shall not be called by application. |
lypinator | 0:bb348c97df44 | 143 | * |
lypinator | 0:bb348c97df44 | 144 | * @param msgId Message id |
lypinator | 0:bb348c97df44 | 145 | * @param pData Pointer to message data |
lypinator | 0:bb348c97df44 | 146 | * @return None |
lypinator | 0:bb348c97df44 | 147 | */ |
lypinator | 0:bb348c97df44 | 148 | extern void cbBSL_handleMsg(cb_uint32 msgId, void* pData); |
lypinator | 0:bb348c97df44 | 149 | |
lypinator | 0:bb348c97df44 | 150 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 151 | } |
lypinator | 0:bb348c97df44 | 152 | #endif |
lypinator | 0:bb348c97df44 | 153 | |
lypinator | 0:bb348c97df44 | 154 | #endif |