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.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.h |
lypinator | 0:bb348c97df44 | 19 | * |
lypinator | 0:bb348c97df44 | 20 | * Description : Data management for RFCOMM based profiles such and Serial |
lypinator | 0:bb348c97df44 | 21 | * Port Profile (SPP). |
lypinator | 0:bb348c97df44 | 22 | * |
lypinator | 0:bb348c97df44 | 23 | *-------------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 24 | |
lypinator | 0:bb348c97df44 | 25 | /** |
lypinator | 0:bb348c97df44 | 26 | * @file cb_bt_serial.h |
lypinator | 0:bb348c97df44 | 27 | * @brief Data management for RFCOMM based profiles such and Serial |
lypinator | 0:bb348c97df44 | 28 | * Port Profile (SPP). |
lypinator | 0:bb348c97df44 | 29 | */ |
lypinator | 0:bb348c97df44 | 30 | |
lypinator | 0:bb348c97df44 | 31 | #ifndef _CB_BT_SERIAL_H_ |
lypinator | 0:bb348c97df44 | 32 | #define _CB_BT_SERIAL_H_ |
lypinator | 0:bb348c97df44 | 33 | |
lypinator | 0:bb348c97df44 | 34 | #include "cb_comdefs.h" |
lypinator | 0:bb348c97df44 | 35 | #include "bt_types.h" |
lypinator | 0:bb348c97df44 | 36 | #include "cb_bt_conn_man.h" |
lypinator | 0:bb348c97df44 | 37 | |
lypinator | 0:bb348c97df44 | 38 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 39 | extern "C" { |
lypinator | 0:bb348c97df44 | 40 | #endif |
lypinator | 0:bb348c97df44 | 41 | |
lypinator | 0:bb348c97df44 | 42 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 43 | * DEFINES |
lypinator | 0:bb348c97df44 | 44 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 45 | #define cbBSE_OK 0 |
lypinator | 0:bb348c97df44 | 46 | #define cbBSE_ERROR -1 |
lypinator | 0:bb348c97df44 | 47 | #define cbBSE_NO_DATA -2 |
lypinator | 0:bb348c97df44 | 48 | |
lypinator | 0:bb348c97df44 | 49 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 50 | * TYPES |
lypinator | 0:bb348c97df44 | 51 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 52 | |
lypinator | 0:bb348c97df44 | 53 | typedef void (*cbBSE_DataAvailEvt)( |
lypinator | 0:bb348c97df44 | 54 | cbBCM_Handle handle); |
lypinator | 0:bb348c97df44 | 55 | |
lypinator | 0:bb348c97df44 | 56 | typedef void (*cbBSE_WriteCnf)( |
lypinator | 0:bb348c97df44 | 57 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 58 | cb_int32 status, |
lypinator | 0:bb348c97df44 | 59 | cb_uint32 nBytes, |
lypinator | 0:bb348c97df44 | 60 | cb_int32 tag); |
lypinator | 0:bb348c97df44 | 61 | |
lypinator | 0:bb348c97df44 | 62 | typedef struct |
lypinator | 0:bb348c97df44 | 63 | { |
lypinator | 0:bb348c97df44 | 64 | cbBSE_DataAvailEvt pfDataEvt; |
lypinator | 0:bb348c97df44 | 65 | cbBSE_WriteCnf pfWriteCnf; |
lypinator | 0:bb348c97df44 | 66 | } cbBSE_Callback; |
lypinator | 0:bb348c97df44 | 67 | |
lypinator | 0:bb348c97df44 | 68 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 69 | * FUNCTIONS |
lypinator | 0:bb348c97df44 | 70 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 71 | |
lypinator | 0:bb348c97df44 | 72 | /** |
lypinator | 0:bb348c97df44 | 73 | * Initialization of Bluetooth serial manager. Called during stack |
lypinator | 0:bb348c97df44 | 74 | * initialization. Shall not be called by application. |
lypinator | 0:bb348c97df44 | 75 | * |
lypinator | 0:bb348c97df44 | 76 | * @return None |
lypinator | 0:bb348c97df44 | 77 | */ |
lypinator | 0:bb348c97df44 | 78 | extern void cbBSE_init(void); |
lypinator | 0:bb348c97df44 | 79 | |
lypinator | 0:bb348c97df44 | 80 | /** |
lypinator | 0:bb348c97df44 | 81 | * Open a data channel. |
lypinator | 0:bb348c97df44 | 82 | * |
lypinator | 0:bb348c97df44 | 83 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 84 | * @param pCallback Callback for data events. |
lypinator | 0:bb348c97df44 | 85 | * @return If the operation is successful cbBSE_OK is returned. |
lypinator | 0:bb348c97df44 | 86 | */ |
lypinator | 0:bb348c97df44 | 87 | extern cb_int32 cbBSE_open( |
lypinator | 0:bb348c97df44 | 88 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 89 | cbBSE_Callback *pCallback); |
lypinator | 0:bb348c97df44 | 90 | |
lypinator | 0:bb348c97df44 | 91 | /** |
lypinator | 0:bb348c97df44 | 92 | * Send data to remote device. A data confirmation event is generated when |
lypinator | 0:bb348c97df44 | 93 | * the data has been sent and a cbBSE_write call can be done. |
lypinator | 0:bb348c97df44 | 94 | * |
lypinator | 0:bb348c97df44 | 95 | * Detailed description optionally verbose. |
lypinator | 0:bb348c97df44 | 96 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 97 | * @param pBuf Data pointer |
lypinator | 0:bb348c97df44 | 98 | * @param nBytes nBytes Size of data to be sent. |
lypinator | 0:bb348c97df44 | 99 | * @param tag Tag passed as argument in corresponding data confirmation callback. |
lypinator | 0:bb348c97df44 | 100 | * @return If the operation is successful cbBSE_OK is returned. |
lypinator | 0:bb348c97df44 | 101 | */ |
lypinator | 0:bb348c97df44 | 102 | extern cb_int32 cbBSE_write( |
lypinator | 0:bb348c97df44 | 103 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 104 | cb_uint8 *pBuf, |
lypinator | 0:bb348c97df44 | 105 | cb_uint32 nBytes, |
lypinator | 0:bb348c97df44 | 106 | cb_int32 tag); |
lypinator | 0:bb348c97df44 | 107 | |
lypinator | 0:bb348c97df44 | 108 | /** |
lypinator | 0:bb348c97df44 | 109 | * Get received data. |
lypinator | 0:bb348c97df44 | 110 | * |
lypinator | 0:bb348c97df44 | 111 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 112 | * @param ppBuf Pointer to data buffer |
lypinator | 0:bb348c97df44 | 113 | * @param pLength Pointer to buffer length variable. |
lypinator | 0:bb348c97df44 | 114 | * @return cbBSE_OK is returned if data is available. If no data is available |
lypinator | 0:bb348c97df44 | 115 | * then cbBSE_NO_DATA is returned. |
lypinator | 0:bb348c97df44 | 116 | */ |
lypinator | 0:bb348c97df44 | 117 | extern cb_int32 cbBSE_getReadBuf( |
lypinator | 0:bb348c97df44 | 118 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 119 | cb_uint8 **ppBuf, |
lypinator | 0:bb348c97df44 | 120 | cb_uint32 *pLength); |
lypinator | 0:bb348c97df44 | 121 | |
lypinator | 0:bb348c97df44 | 122 | /** |
lypinator | 0:bb348c97df44 | 123 | * Notify that received data has been handled and underlying buffers |
lypinator | 0:bb348c97df44 | 124 | * can be freed. |
lypinator | 0:bb348c97df44 | 125 | * |
lypinator | 0:bb348c97df44 | 126 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 127 | * @param nBytes Number of bytes consumed. |
lypinator | 0:bb348c97df44 | 128 | * @return If the operation is successful cbBSE_OK is returned. |
lypinator | 0:bb348c97df44 | 129 | */ |
lypinator | 0:bb348c97df44 | 130 | extern cb_int32 cbBSE_readBufConsumed( |
lypinator | 0:bb348c97df44 | 131 | cbBCM_Handle handle, |
lypinator | 0:bb348c97df44 | 132 | cb_uint32 nBytes); |
lypinator | 0:bb348c97df44 | 133 | |
lypinator | 0:bb348c97df44 | 134 | /** |
lypinator | 0:bb348c97df44 | 135 | * Read max frame size for a data channel. |
lypinator | 0:bb348c97df44 | 136 | * |
lypinator | 0:bb348c97df44 | 137 | * @param handle Connection handle |
lypinator | 0:bb348c97df44 | 138 | * @param pFrameSize Max frame size for connection. |
lypinator | 0:bb348c97df44 | 139 | * @return If the operation is successful cbBSE_OK is returned. |
lypinator | 0:bb348c97df44 | 140 | */ |
lypinator | 0:bb348c97df44 | 141 | extern cb_int32 cbBSE_frameSize(cbBCM_Handle handle, cb_uint32 *pFrameSize); |
lypinator | 0:bb348c97df44 | 142 | |
lypinator | 0:bb348c97df44 | 143 | /** |
lypinator | 0:bb348c97df44 | 144 | * Bluetooth serial message handling. Shall not be called by application. |
lypinator | 0:bb348c97df44 | 145 | * |
lypinator | 0:bb348c97df44 | 146 | * @param msgId Message id |
lypinator | 0:bb348c97df44 | 147 | * @param pData Pointer to message data |
lypinator | 0:bb348c97df44 | 148 | * @return None |
lypinator | 0:bb348c97df44 | 149 | */ |
lypinator | 0:bb348c97df44 | 150 | extern void cbBSE_handleMsg(cb_uint32 msgId, void* pData); |
lypinator | 0:bb348c97df44 | 151 | |
lypinator | 0:bb348c97df44 | 152 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 153 | } |
lypinator | 0:bb348c97df44 | 154 | #endif |
lypinator | 0:bb348c97df44 | 155 | |
lypinator | 0:bb348c97df44 | 156 | #endif |