Added ability to specify optional sketch version number.
Specify with homeSpan.setSketchVersion(char *). Read back with homeSpan.getSketchVersion(). Also, MDNS now broadcasts three new fields: hspn = HomeSpan Version sketch = Sketch Version ota = "yes" if OTA enabled, else "no" These are all optional to HAP but useful if trying to keep track of version updates when using OTA and Serial Monitor is not available.
This commit is contained in:
parent
78b7900f19
commit
db3e1c4bb8
|
|
@ -70,7 +70,9 @@ void Span::begin(Category catID, const char *displayName, const char *hostNameBa
|
|||
Serial.print("\nStatus LED: Pin ");
|
||||
Serial.print(statusPin);
|
||||
Serial.print("\nDevice Control: Pin ");
|
||||
Serial.print(controlPin);
|
||||
Serial.print(controlPin);
|
||||
Serial.print("\nSketch Version: ");
|
||||
Serial.print(getSketchVersion());
|
||||
Serial.print("\nHomeSpan Version: ");
|
||||
Serial.print(HOMESPAN_VERSION);
|
||||
Serial.print("\nESP-IDF Version: ");
|
||||
|
|
@ -422,6 +424,10 @@ void Span::checkConnect(){
|
|||
else
|
||||
mdns_service_txt_item_set("_hap","_tcp","sf","0"); // set Status Flag = 0
|
||||
|
||||
mdns_service_txt_item_set("_hap","_tcp","hspn",HOMESPAN_VERSION); // HomeSpan Version Number (info only - NOT used by HAP)
|
||||
mdns_service_txt_item_set("_hap","_tcp","sketch",sketchVersion); // Sketch Version (info only - NOT used by HAP)
|
||||
mdns_service_txt_item_set("_hap","_tcp","ota",otaEnabled?"yes":"no"); // OTA Enabled (info only - NOT used by HAP)
|
||||
|
||||
uint8_t hashInput[22];
|
||||
uint8_t hashOutput[64];
|
||||
char setupHash[9];
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ struct Span{
|
|||
String configLog; // log of configuration process, including any errors
|
||||
boolean isBridge=true; // flag indicating whether device is configured as a bridge (i.e. first Accessory contains nothing but AccessoryInformation and HAPProtocolInformation)
|
||||
HapQR qrCode; // optional QR Code to use for pairing
|
||||
const char *sketchVersion="n/a"; // version of the sketch
|
||||
|
||||
boolean connected=false; // WiFi connection status
|
||||
unsigned long waitTime=60000; // time to wait (in milliseconds) between WiFi connection attempts
|
||||
|
|
@ -153,6 +154,8 @@ struct Span{
|
|||
void setPortNum(uint16_t port){tcpPortNum=port;} // sets the TCP port number to use for communications between HomeKit and HomeSpan
|
||||
void setQRID(const char *id); // sets the Setup ID for optional pairing with a QR Code
|
||||
void enableOTA(){otaEnabled=true;} // enables Over-the-Air updates
|
||||
void setSketchVersion(const char *sVer){sketchVersion=sVer;} // set optional sketch version number
|
||||
const char *getSketchVersion(){return sketchVersion;} // get sketch version number
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ void setup() {
|
|||
homeSpan.setMaxConnections(16);
|
||||
// homeSpan.setQRID("One1");
|
||||
homeSpan.enableOTA();
|
||||
homeSpan.setSketchVersion("Test 1.2.3");
|
||||
|
||||
homeSpan.begin(Category::Lighting,"HomeSpanTest");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue