Initial Commit

This commit is contained in:
2018-12-18 12:07:12 +01:00
commit 7ad040c6c1
31 changed files with 1974 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
#include <stdexcept>
#include <unistd.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include "Socket.h"
namespace PresenceDetection {
namespace Bluetooth {
Socket::Socket()
{
m_descriptor = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);
if (m_descriptor < 0)
throw std::runtime_error("Can't create Bluetooth socket");
}
Socket::~Socket()
{
close(m_descriptor);
}
int Socket::Descriptor() const
{
return m_descriptor;
}
} // namespace Bluetooth
} // namespace PresenceDetection