ESP_IOT v2.5
IOT ESP Coding
BLEServerNetworking.cpp File Reference
#include "BLEServerNetworking.h"
#include <NimBLEDevice.h>
#include "../../Defines.h"
Include dependency graph for BLEServerNetworking.cpp:

Go to the source code of this file.

Classes

class  BLEServeNetworkingCallbacks
 
class  BLEServerNetworkingCharacteristicCallbacks
 Note: the onRead and onWrite are from the perspective of the client. So onRead is the client calling this server, over BLE, and reading a value. The onWrite is the client writing to this server (sending a BLE message). This is where JSON or raw values are used. More...
 
class  BLEServerNetworkingDescriptorCallbacks
 

Macros

#define pettutorApproach
 
#define MAX_MESSAGE   600
 

Functions

char * getServiceName_BLEServerNetworking ()
 retrieve the service name (PTFEEDER, PTFeeder:Name, PTClicker:Name, etc) More...
 
void setBLEServerDeviceName (char *deviceName)
 sets the device name More...
 
void loop_BLEServerNetworking ()
 the 'loop' for this module BLEServerNetworking. More...
 
void setup_BLEServerNetworking (char *serviceName, char *deviceName, char *serviceUUID, char *characteristicUUID)
 the 'setup' for this module BLEServerNetworking. Here the service name is added (and potentially more later) More...
 
void sendBLEMessageACKMessage ()
 send ACK over bluetooth, this right now is 0x01 More...
 

Variables

NimBLECharacteristic * _pCharacteristic
 
char * _deviceName_BLEServer = NULL
 device name More...
 
char _serviceName_BLEServer [50]
 
char * _SERVICE_UUID
 need to device way to change these ... More...
 
char * _CHARACTERISTIC_UUID
 
char _asciiMessage [MAX_MESSAGE]
 

Macro Definition Documentation

◆ MAX_MESSAGE

#define MAX_MESSAGE   600

Definition at line 31 of file BLEServerNetworking.cpp.

◆ pettutorApproach

#define pettutorApproach

BLEServerNetworking

Definition at line 14 of file BLEServerNetworking.cpp.

Function Documentation

◆ getServiceName_BLEServerNetworking()

char * getServiceName_BLEServerNetworking ( )

retrieve the service name (PTFEEDER, PTFeeder:Name, PTClicker:Name, etc)

Definition at line 36 of file BLEServerNetworking.cpp.

Here is the caller graph for this function:

◆ loop_BLEServerNetworking()

void loop_BLEServerNetworking ( )

the 'loop' for this module BLEServerNetworking.

the 'setup' for this module BLEServerNetworking. Here the service name is added (and potentially more later)

Definition at line 327 of file BLEServerNetworking.cpp.

Here is the caller graph for this function:

◆ sendBLEMessageACKMessage()

void sendBLEMessageACKMessage ( )

send ACK over bluetooth, this right now is 0x01

send something over bluetooth, this right now is 0x01

Definition at line 590 of file BLEServerNetworking.cpp.

Here is the caller graph for this function:

◆ setBLEServerDeviceName()

void setBLEServerDeviceName ( char *  deviceName)

sets the device name

NOT CALLED... sets the device name in the advertising

Definition at line 43 of file BLEServerNetworking.cpp.

◆ setup_BLEServerNetworking()

void setup_BLEServerNetworking ( char *  serviceName,
char *  deviceName,
char *  serviceUUID,
char *  characteristicUUID 
)

the 'setup' for this module BLEServerNetworking. Here the service name is added (and potentially more later)

defines the operations on BLE Server Networking BLEServerNetworking is the "server" side of the BLE interface

currently not using the option, just doing it...

sets device name

Optional: set the transmit power, default is 3db

+9db

Set the IO capabilities of the device, each option will trigger a different pairing method. BLE_HS_IO_DISPLAY_ONLY - Passkey pairing BLE_HS_IO_DISPLAY_YESNO - Numeric comparison pairing BLE_HS_IO_NO_INPUT_OUTPUT - DEFAULT setting - just works pairing

2 different ways to set security - both calls achieve the same result. no bonding, no man in the middle protection, secure connections.

These are the default values, only shown here for demonstration.

Require a secure connection for read and write access

2904 descriptors are a special case, when createDescriptor is called with 0x2904 a NimBLE2904 class is created with the correct properties and sizes. However we must cast the returned reference to the correct type as the method only returns a pointer to the base NimBLEDescriptor class.

Note a 0x2902 descriptor MUST NOT be created as NimBLE will create one automatically if notification or indication properties are assigned to a characteristic.

Custom descriptor: Arguments are UUID, Properties, max length in bytes of the value

Start the services when finished creating all Characteristics and Descriptors

Add the services to the advertisment data

If your device is battery powered you may consider setting scan response to false as it will extend battery life at the expense of less data sent.

setName shows up ad LocalName in Punchthrough Scanner, but

Definition at line 355 of file BLEServerNetworking.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _asciiMessage

char _asciiMessage[MAX_MESSAGE]

Definition at line 32 of file BLEServerNetworking.cpp.

◆ _CHARACTERISTIC_UUID

char* _CHARACTERISTIC_UUID

Definition at line 29 of file BLEServerNetworking.cpp.

◆ _deviceName_BLEServer

char* _deviceName_BLEServer = NULL

device name

Definition at line 21 of file BLEServerNetworking.cpp.

◆ _pCharacteristic

NimBLECharacteristic* _pCharacteristic

Definition at line 18 of file BLEServerNetworking.cpp.

◆ _SERVICE_UUID

char* _SERVICE_UUID

need to device way to change these ...

Definition at line 28 of file BLEServerNetworking.cpp.

◆ _serviceName_BLEServer

char _serviceName_BLEServer[50]

Definition at line 23 of file BLEServerNetworking.cpp.