1 parent
ebf82fbb38
commit
8e974ccad9
1 file changed
+23
-6
+23
-6
@@ -50,14 +50,31 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
|
|||||||
mac_adress.toUpperCase();
|
mac_adress.toUpperCase();
|
||||||
String mactopic = subjectBTtoMQTT + mac_adress;
|
String mactopic = subjectBTtoMQTT + mac_adress;
|
||||||
if (advertisedDevice.haveName()){
|
if (advertisedDevice.haveName()){
|
||||||
|
trc(F("Get Name "));
|
||||||
String nameBLE = advertisedDevice.getName().c_str();
|
String nameBLE = advertisedDevice.getName().c_str();
|
||||||
trc(mactopic + " " + nameBLE);
|
trc(nameBLE);
|
||||||
client.publish((char *)(mactopic + "/name").c_str(),(char *)nameBLE.c_str());
|
client.publish((char *)(mactopic + "/name").c_str(),(char *)nameBLE.c_str());
|
||||||
}
|
}
|
||||||
String rssi = String(advertisedDevice.getRSSI());
|
if (advertisedDevice.haveManufacturerData()){
|
||||||
trc(mactopic + " " + rssi);
|
trc(F("Get ManufacturerData "));
|
||||||
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
|
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()){
|
if (advertisedDevice.haveServiceData()){
|
||||||
trc(F("Get service data "));
|
trc(F("Get service data "));
|
||||||
std::string serviceData = advertisedDevice.getServiceData();
|
std::string serviceData = advertisedDevice.getServiceData();
|
||||||
|
|||||||
Reference in new issue
Block a user