Implement use of Inventory API
This commit is contained in:
@@ -113,7 +113,14 @@ int main(int argc, char** argv)
|
||||
else
|
||||
throw std::runtime_error("UniFi CookieFile directive missing in ini file.");
|
||||
|
||||
pUniFiDevice = std::make_shared<PresenceDetection::UniFi::Device>(hostname, username, password, cookiefile, target);
|
||||
std::string inventoryURL;
|
||||
boost::optional<boost::property_tree::ptree&> bluetoothInventoryURL = pt.get_child_optional("UniFi.Inventory");
|
||||
if (bluetoothInventoryURL)
|
||||
inventoryURL = pt.get<std::string>("UniFi.Inventory");
|
||||
else
|
||||
throw std::runtime_error("UniFi Inventory directive missing in ini file.");
|
||||
|
||||
pUniFiDevice = std::make_shared<PresenceDetection::UniFi::Device>(hostname, username, password, cookiefile, inventoryURL, target);
|
||||
}
|
||||
|
||||
std::shared_ptr<PresenceDetection::Bluetooth::Device> pBluetoothDevice;
|
||||
|
||||
+33
-2
@@ -1,3 +1,4 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -16,6 +17,8 @@
|
||||
#include <bluetooth/hci_lib.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
|
||||
#include "Util/Timer.h"
|
||||
|
||||
/* Defaults */
|
||||
static bdaddr_t bdaddr;
|
||||
static int size = 44;
|
||||
@@ -224,13 +227,41 @@ error:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void print()
|
||||
{
|
||||
std::cout << "Print" << std::endl;
|
||||
}
|
||||
|
||||
int main(int /*argc*/, char** /*argv[]*/)
|
||||
{
|
||||
std::string address = "48:4B:AA:85:30:C5";
|
||||
ping(address.c_str());
|
||||
//std::string address = "48:4B:AA:85:30:C5";
|
||||
//ping(address.c_str());
|
||||
|
||||
//address = "d0:c5:f3:84:99:de";
|
||||
//ping(address.c_str());
|
||||
|
||||
PresenceDetection::Util::Timer timer;
|
||||
std::function<void()> f_print = print;
|
||||
|
||||
std::cout << "---" << std::endl;
|
||||
timer.StartContinuous(1000, f_print);
|
||||
timer.Stop();
|
||||
timer.Wait();
|
||||
std::cout << "---" << std::endl << std::endl;
|
||||
|
||||
std::cout << "---" << std::endl;
|
||||
timer.StartContinuous(3000, f_print);
|
||||
timer.Abort();
|
||||
timer.Wait();
|
||||
std::cout << "---" << std::endl << std::endl;
|
||||
|
||||
std::cout << "---" << std::endl;
|
||||
timer.StartContinuous(3000, f_print);
|
||||
sleep(1);
|
||||
timer.Abort();
|
||||
timer.Wait();
|
||||
std::cout << "---" << std::endl << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user