Compare commits
4 Commits
bf21b61803
...
361424ded3
| Author | SHA1 | Date | |
|---|---|---|---|
|
361424ded3
|
|||
|
e1bbccd755
|
|||
|
f7dd083992
|
|||
|
8a992787df
|
@@ -1,3 +1,3 @@
|
||||
# OTALibrary
|
||||
# BLEOTA
|
||||
|
||||
The library for the micro controller to update its software Over The Air.
|
||||
A library for esp32 Over the Air updates using BLE.
|
||||
21
library.json
Normal file
21
library.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "BLEOTA",
|
||||
"description": "A library for esp32 Over the Air updates using BLE",
|
||||
"repository":
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://git.emaker.limited:MicrocontrollerCD/BLEOTA.git"
|
||||
},
|
||||
"authors":
|
||||
[
|
||||
{
|
||||
"name": "chopster44",
|
||||
"email": "me@chopster44.com",
|
||||
"maintainer": true
|
||||
}
|
||||
],
|
||||
"version": "0.0.1",
|
||||
"frameworks": "arduino",
|
||||
"platforms": ["espressif32"],
|
||||
"headers": ["BLEOTA.h"]
|
||||
}
|
||||
24
src/BLEOTA.cpp
Normal file
24
src/BLEOTA.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "BLEOTA.h"
|
||||
|
||||
BLEOTAClass::BLEOTAClass(){
|
||||
_pVersionNumber = new BLECharacteristic(VERSION_NUMBER_UUID, BLECharacteristic::PROPERTY_NOTIFY);
|
||||
_pVersionNumberDescriptor = new BLEDescriptor(VERSION_NUMBER_DESCRIPTOR_UUID);
|
||||
};
|
||||
|
||||
void BLEOTAClass::begin(BLEServer* server, char* versionNumber) {
|
||||
// set internal versionNumber
|
||||
_vNum = versionNumber;
|
||||
// set internal server
|
||||
_pServer = server;
|
||||
// create service
|
||||
BLEService* otaService = _pServer->createService(OTA_SERVICE_UUID);
|
||||
// version number property
|
||||
otaService->addCharacteristic(_pVersionNumber);
|
||||
_pVersionNumber->setValue(_vNum);
|
||||
_pVersionNumberDescriptor->setValue("Version Number");
|
||||
_pVersionNumber->addDescriptor(_pVersionNumberDescriptor);
|
||||
|
||||
otaService->start();
|
||||
}
|
||||
|
||||
BLEOTAClass BLEota;
|
||||
24
src/BLEOTA.h
Normal file
24
src/BLEOTA.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef BLEOTA
|
||||
#define BLEOTA
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <BLEServer.h>
|
||||
|
||||
#define OTA_SERVICE_UUID "71a4438e-fd52-4b15-b3d2-ec0e3e56193b"
|
||||
#define VERSION_NUMBER_UUID "1978a3df-c009-4837-b295-57ef429dde8c"
|
||||
#define VERSION_NUMBER_DESCRIPTOR_UUID "1e0c35d1-ba03-4f4d-a99c-bac7664d95ed"
|
||||
|
||||
class BLEOTAClass {
|
||||
public:
|
||||
BLEOTAClass();
|
||||
void begin(BLEServer* server, char* versionNumber = "1.0.0");
|
||||
private:
|
||||
BLEServer* _pServer;
|
||||
char* _vNum;
|
||||
BLECharacteristic* _pVersionNumber;
|
||||
BLEDescriptor* _pVersionNumberDescriptor;
|
||||
};
|
||||
|
||||
extern BLEOTAClass BLEota;
|
||||
|
||||
#endif /* BLEOTA */
|
||||
Reference in New Issue
Block a user