2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20#include "net/rc/SocketAddress.h"
22#include "net/SocketAddress.hpp"
24#ifndef DOXYGEN_SHOULD_SKIP_THIS
31 :
Super(AF_BLUETOOTH) {
44 SocketAddress::
SocketAddress(
const std::string& btAddress, uint8_t channel)
50 SocketAddress::
SocketAddress(
const SockAddr& sockAddr, SockLen sockAddrLen)
52 channel = sockAddr.rc_channel;
55 ba2str(&sockAddr.rc_bdaddr, btAddressC);
56 btAddress = btAddressC;
59 void SocketAddress::
init() {
60 sockAddr.rc_channel = channel;
61 str2ba(btAddress.c_str(), &sockAddr.rc_bdaddr);
64 SocketAddress& SocketAddress::
setBtAddress(
const std::string& btAddress) {
65 this->btAddress = btAddress;
74 SocketAddress& SocketAddress::
setChannel(uint8_t channel) {
84 std::string SocketAddress::
toString(
bool expanded)
const {
85 return std::string(btAddress).append(expanded ? std::string(
":").append(std::to_string(channel)) :
"");
uint8_t getChannel() const
SocketAddress & setChannel(uint8_t channel)
SocketAddress(const std::string &btAddress, uint8_t channel)
std::string toString(bool expanded=true) const override
SocketAddress(const std::string &btAddress)
SocketAddress & setBtAddress(const std::string &btAddress)
SocketAddress(const SockAddr &sockAddr, SockLen sockAddrLen)
std::string getBtAddress() const
SocketAddress(uint8_t channel)