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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers network_stubs.h Source File

network_stubs.h

Go to the documentation of this file.
00001 /**
00002  * @file    network_stubs.h
00003  * @brief   mbed Endpoint Network Stubs header (BLE)
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 #ifndef __BLE_STUBS_H__
00023 #define __BLE_STUBS_H__
00024 
00025 // mbed support
00026 #include "mbed.h"
00027 
00028 // NSP support
00029 #include "nsdl_support.h"
00030 
00031 // 9/4/15: Android 5.x appears to have some sort of poor-mans DDoS detector in its BLE stack so we have to slow things down a bit.. 
00032 #define ANDROID_BLE_DELAY          true           // true to enable slow down, comment out to disable 
00033 #define ANDROID_BLE_DELAY_MS       200            // delay time (in ms), if enabled, to allow android 5.x to catch up... 
00034 
00035 // configure the endpoint
00036 extern void configure_endpoint();
00037 
00038 // we have to redefine DBG as its used differently here...
00039 #ifdef DBG
00040     #undef DBG
00041 #endif
00042 #define DBG  printf
00043 
00044 #include "mbed.h"
00045 
00046 #define IP_ADDRESS_LENGTH  64
00047 
00048 // timeval
00049 struct timeval {
00050     uint32_t tv_sec;
00051     uint32_t tv_usec;
00052 };
00053 
00054 // socket length is simply an unsigned int.
00055 typedef uint32_t socklen_t;
00056 
00057 #endif // __BLE_STUBS_H__