diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-21 10:30:06 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-21 10:30:06 +0200 |
commit | 68a5c65f9b0e1df30e9cef490d9b218b2f21f90d (patch) | |
tree | 804ec0edc0769764b0a090703cf784c2ac7a6f5c /client/sock.cpp | |
parent | db8906d54cd9afbc57f0b40a0d618335c552f704 (diff) |
clean up puzbusv1 API
Diffstat (limited to 'client/sock.cpp')
-rw-r--r-- | client/sock.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/client/sock.cpp b/client/sock.cpp index cc18a69..f967f64 100644 --- a/client/sock.cpp +++ b/client/sock.cpp @@ -18,7 +18,7 @@ using std::logic_error; using std::thread; PBSocket::PBSocket() { } -PBSocket::PBSocket(char* addr, uint16_t port) : PBSocket() { +PBSocket::PBSocket(const char * addr, uint16_t port) : PBSocket() { set_server(addr, port); } @@ -32,7 +32,7 @@ PBSocket::~PBSocket() { sock_close(); } -void PBSocket::set_server(char* addr, uint16_t port) { +void PBSocket::set_server(const char * addr, uint16_t port) { _addr = addr; _port = port; } @@ -67,7 +67,7 @@ void PBSocket::sock_close() { _fd = -1; } -void PBSocket::send(char* buf, size_t buf_sz) { +void PBSocket::send(const char * buf, size_t buf_sz) { write(_fd, buf, buf_sz); } @@ -105,10 +105,10 @@ void PBSocket::sock_task() { sock_close(); } -void i2c_send(uint16_t addr, char* data, size_t data_size) { +void i2c_send(uint16_t addr, const char * data, size_t data_size) { struct pb_msg msg = { .addr = addr, - .data = data, + .data = (char *) data, .length = data_size, }; @@ -119,7 +119,7 @@ void i2c_send(uint16_t addr, char* data, size_t data_size) { sock->send(packed, size); } -void i2c_recv(uint16_t addr, char* data, size_t data_size) { +void i2c_recv(uint16_t addr, const char * data, size_t data_size) { rl_printf("[0x%02x]: %.*s\n", addr, data_size, data); } |