BLE mbed Endpoint network stack for mbedConnectorInterface. The stack makes use of a special BLE Socket abstraction to create socket() semantics over BLE.
Dependencies: libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler
UartRPC.h
00001 /** 00002 * @file UartRPC.h 00003 * @brief BLE UART RPC header 00004 * @author Doug Anson 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #ifndef __UART_RPC_H__ 00024 #define __UART_RPC_H__ 00025 00026 #include "mbed.h" 00027 #include <stdarg.h> 00028 #include "BLEDevice.h" 00029 #include "Dispatcher.h" 00030 #include "BLELocation.h" 00031 00032 // callback function for dispatch callbacks ( 00033 typedef void (*ble_dispatch_callback_fn)(bool); 00034 00035 class UartRPC { 00036 public: 00037 UartRPC(BLEDevice &ble); 00038 00039 // remote dispatch 00040 int dispatch(uint8_t fn_id,void *cb,uint8_t *response,int response_length,const char *format,...); 00041 00042 // local accumulate and dispatch of packets 00043 bool accumulate(uint8_t *buffer,int buffer_length); 00044 void dispatch(); 00045 bool localDispatchAvailable(void); 00046 int retrieveLocalDispatch(uint8_t *buffer,int buffer_length); 00047 void setLocationInstance(BLELocation *location); 00048 00049 private: 00050 void resetLocalDispatch(void); 00051 00052 Dispatcher m_dispatcher; 00053 SplitterAssembler m_recv_accumulator; 00054 bool m_local_dispatch_available; 00055 char *m_recv_raw_data; 00056 int m_recv_raw_data_length; 00057 void *m_cb; 00058 BLELocation *m_location; 00059 }; 00060 00061 #endif // __UART_RPC_H__
Generated on Sun Jul 17 2022 05:11:06 by 1.7.2