Doug Anson / mbedEndpointNetwork_BLE

Dependencies:   libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler

Committer:
ansond
Date:
Sat Jul 25 19:15:48 2015 +0000
Revision:
33:4f6929e123f2
Parent:
11:d601b867b297
Child:
36:aa73681951ad
updates for BLE Location

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 5:9233e88b9c83 1 /**
ansond 5:9233e88b9c83 2 * @file UartRPC.h
ansond 5:9233e88b9c83 3 * @brief BLE UART RPC header
ansond 5:9233e88b9c83 4 * @author Doug Anson
ansond 5:9233e88b9c83 5 * @version 1.0
ansond 5:9233e88b9c83 6 * @see
ansond 5:9233e88b9c83 7 *
ansond 5:9233e88b9c83 8 * Copyright (c) 2014
ansond 5:9233e88b9c83 9 *
ansond 5:9233e88b9c83 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 5:9233e88b9c83 11 * you may not use this file except in compliance with the License.
ansond 5:9233e88b9c83 12 * You may obtain a copy of the License at
ansond 5:9233e88b9c83 13 *
ansond 5:9233e88b9c83 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 5:9233e88b9c83 15 *
ansond 5:9233e88b9c83 16 * Unless required by applicable law or agreed to in writing, software
ansond 5:9233e88b9c83 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 5:9233e88b9c83 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 5:9233e88b9c83 19 * See the License for the specific language governing permissions and
ansond 5:9233e88b9c83 20 * limitations under the License.
ansond 5:9233e88b9c83 21 */
ansond 5:9233e88b9c83 22
ansond 5:9233e88b9c83 23 #ifndef __UART_RPC_H__
ansond 5:9233e88b9c83 24 #define __UART_RPC_H__
ansond 5:9233e88b9c83 25
ansond 5:9233e88b9c83 26 #include "mbed.h"
ansond 5:9233e88b9c83 27 #include <stdarg.h>
ansond 5:9233e88b9c83 28 #include "BLEDevice.h"
ansond 5:9233e88b9c83 29 #include "Dispatcher.h"
ansond 33:4f6929e123f2 30 #include "BLELocation.h"
ansond 11:d601b867b297 31
ansond 11:d601b867b297 32 // callback function for dispatch callbacks (
ansond 11:d601b867b297 33 typedef void (*ble_dispatch_callback_fn)(bool);
ansond 6:98af441fd960 34
ansond 5:9233e88b9c83 35 class UartRPC {
ansond 5:9233e88b9c83 36 public:
ansond 5:9233e88b9c83 37 UartRPC(BLEDevice &ble);
ansond 9:bf0cf5828378 38
ansond 9:bf0cf5828378 39 // remote dispatch
ansond 11:d601b867b297 40 int dispatch(uint8_t fn_id,void *cb,uint8_t *response,int response_length,const char *format,...);
ansond 9:bf0cf5828378 41
ansond 9:bf0cf5828378 42 // local accumulate and dispatch of packets
ansond 9:bf0cf5828378 43 bool accumulate(uint8_t *buffer,int buffer_length);
ansond 9:bf0cf5828378 44 void dispatch();
ansond 9:bf0cf5828378 45 bool localDispatchAvailable(void);
ansond 9:bf0cf5828378 46 int retrieveLocalDispatch(uint8_t *buffer,int buffer_length);
ansond 33:4f6929e123f2 47 void setLocationInstance(BLELocation *location);
ansond 9:bf0cf5828378 48
ansond 9:bf0cf5828378 49 private:
ansond 9:bf0cf5828378 50 void resetLocalDispatch(void);
ansond 9:bf0cf5828378 51
ansond 9:bf0cf5828378 52 Dispatcher m_dispatcher;
ansond 9:bf0cf5828378 53 SplitterAssembler m_recv_accumulator;
ansond 9:bf0cf5828378 54 bool m_local_dispatch_available;
ansond 9:bf0cf5828378 55 char *m_recv_raw_data;
ansond 9:bf0cf5828378 56 int m_recv_raw_data_length;
ansond 11:d601b867b297 57 void *m_cb;
ansond 33:4f6929e123f2 58 BLELocation *m_location;
ansond 5:9233e88b9c83 59 };
ansond 5:9233e88b9c83 60
ansond 5:9233e88b9c83 61 #endif // __UART_RPC_H__