2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#include "net/rc/SocketAddress.h"
44#include "net/SocketAddress.hpp"
46#ifndef DOXYGEN_SHOULD_SKIP_THIS
53 :
Super(AF_BLUETOOTH) {
66 SocketAddress::
SocketAddress(
const std::string& btAddress, uint8_t channel)
72 SocketAddress::
SocketAddress(
const SockAddr& sockAddr, SockLen sockAddrLen)
74 channel = sockAddr.rc_channel;
77 ba2str(&sockAddr.rc_bdaddr, btAddressC);
78 btAddress = btAddressC;
81 void SocketAddress::
init() {
82 sockAddr.rc_channel = channel;
83 str2ba(btAddress.c_str(), &sockAddr.rc_bdaddr);
86 SocketAddress& SocketAddress::
setBtAddress(
const std::string& btAddress) {
87 this->btAddress = btAddress;
96 SocketAddress& SocketAddress::
setChannel(uint8_t channel) {
106 std::string SocketAddress::
toString(
bool expanded)
const {
107 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)