Add use of DomoticaServer API for Bluetooth Addresses
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <sstream>
|
||||
#include <syslog.h>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "Util/JSON.h"
|
||||
#include "Functions.h"
|
||||
#include "Device.h"
|
||||
|
||||
@@ -8,10 +9,16 @@
|
||||
namespace PresenceDetection {
|
||||
namespace Bluetooth {
|
||||
|
||||
Device::Device(const std::string& devices, const std::string& target) :
|
||||
Device::Device(const std::string& inventoryURL, const std::string& target) :
|
||||
m_target(target)
|
||||
{
|
||||
boost::split(m_devices, devices, boost::is_any_of(","));
|
||||
std::string devices = m_httpClient.GetUrlContents(inventoryURL);
|
||||
Util::JSON json = Util::JSON::parse(devices);
|
||||
|
||||
for (auto& element : json)
|
||||
if (element["bluetooth"] != "")
|
||||
m_devices.push_back(element["bluetooth"]);
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ namespace Bluetooth {
|
||||
class Device
|
||||
{
|
||||
public:
|
||||
Device(const std::string& devices, const std::string& target);
|
||||
Device(const std::string& inventoryURL, const std::string& target);
|
||||
~Device();
|
||||
|
||||
void Start();
|
||||
|
||||
Reference in New Issue
Block a user