add manufacturer data and txpower retrieving with ESP32

#80
This commit is contained in:
1technophile committed 2018-01-07 14:32:12 +01:00
1 parent ebf82fbb38
commit 8e974ccad9
1 file changed
+23 -6
+23 -6
View File
@@ -50,14 +50,31 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
mac_adress.toUpperCase();
String mactopic = subjectBTtoMQTT + mac_adress;
if (advertisedDevice.haveName()){
trc(F("Get Name "));
String nameBLE = advertisedDevice.getName().c_str();
trc(mactopic + " " + nameBLE);
trc(nameBLE);
client.publish((char *)(mactopic + "/name").c_str(),(char *)nameBLE.c_str());
}
String rssi = String(advertisedDevice.getRSSI());
trc(mactopic + " " + rssi);
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
}
if (advertisedDevice.haveManufacturerData()){
trc(F("Get ManufacturerData "));
String ManufacturerData = advertisedDevice.getManufacturerData().c_str();
trc(ManufacturerData);
client.publish((char *)(mactopic + "/ManufacturerData").c_str(),(char *)ManufacturerData.c_str());
}
if (advertisedDevice.haveRSSI()){
trc(F("Get RSSI "));
String rssi = String(advertisedDevice.getRSSI());
trc(mactopic + " " + rssi);
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
}
if (advertisedDevice.haveTXPower()){
trc(F("Get TXPower "));
int8_t TXPower = advertisedDevice.getTXPower();
trc(String(TXPower));
char cTXPower[5];
sprintf(cTXPower, "%d", TXPower);
client.publish((char *)(mactopic + "/tx").c_str(),cTXPower);
}
if (advertisedDevice.haveServiceData()){
trc(F("Get service data "));
std::string serviceData = advertisedDevice.getServiceData();