mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-06-07 09:38:25 +02:00
More responsive touch, optimise release, protocol debug
This commit is contained in:
@@ -26,13 +26,14 @@ LDFLAGS :=
|
|||||||
CXXCOMMON := -Wall -Isrc
|
CXXCOMMON := -Wall -Isrc
|
||||||
|
|
||||||
debug: BUILD_TYPE := debug
|
debug: BUILD_TYPE := debug
|
||||||
debug: CXXFLAGS := -g -O0 -fsanitize=address -fno-omit-frame-pointer
|
debug: CXXFLAGS := -g -O0 -fsanitize=address -fno-omit-frame-pointer -DPROTOCOL_DEBUG
|
||||||
debug: LDFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
debug: LDFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||||
debug: TARGET := $(TARGET_NAME)-debug
|
debug: TARGET := $(TARGET_NAME)-debug
|
||||||
debug: prepare
|
debug: prepare
|
||||||
|
|
||||||
release: BUILD_TYPE := release
|
release: BUILD_TYPE := release
|
||||||
release: CXXFLAGS := -O2
|
release: CXXFLAGS := -O2 -march=native -flto -fno-plt -fdata-sections -ffunction-sections -DNDEBUG
|
||||||
|
release: LDFLAGS += -Wl,--gc-sections -flto
|
||||||
release: TARGET := $(TARGET_NAME)
|
release: TARGET := $(TARGET_NAME)
|
||||||
release: prepare
|
release: prepare
|
||||||
|
|
||||||
|
|||||||
@@ -71,3 +71,11 @@
|
|||||||
#
|
#
|
||||||
#on-connect-script =
|
#on-connect-script =
|
||||||
#on-disconnect-script =
|
#on-disconnect-script =
|
||||||
|
|
||||||
|
# Protocol debug level. Works on debug builds only with PROTOCOL_DEBUG flag set.
|
||||||
|
# 0 - nothing
|
||||||
|
# 1 - unknown commands
|
||||||
|
# 2 - all commands except data streams
|
||||||
|
# 3 - include outgoing commands
|
||||||
|
# 4 - log everything
|
||||||
|
#protocol-debug = 0
|
||||||
+93
-2
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|
||||||
#include "helper/protocol_const.h"
|
#include "helper/protocol_const.h"
|
||||||
@@ -183,6 +184,10 @@ int Connector::send(int cmd, bool encrypt, uint8_t *data, uint32_t size)
|
|||||||
if (data && size > 0)
|
if (data && size > 0)
|
||||||
libusb_bulk_transfer(_device, _endpoint_out, data, size, &transferred, 0);
|
libusb_bulk_transfer(_device, _endpoint_out, data, size, &transferred, 0);
|
||||||
|
|
||||||
|
#ifdef PROTOCOL_DEBUG
|
||||||
|
printMessage(cmd, size, data, magic == MAGIC_ENC, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
return transferred;
|
return transferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,13 +208,94 @@ void Connector::setEncryption(bool enabled)
|
|||||||
_ecnrypt = true;
|
_ecnrypt = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Connector::printInts(uint32_t length, uint8_t *data, uint16_t max)
|
||||||
|
{
|
||||||
|
if (data && length >= 4)
|
||||||
|
{
|
||||||
|
std::cout << " > ";
|
||||||
|
size_t count = length / 4;
|
||||||
|
for (size_t i = 0; (i < count) & (i < max); ++i)
|
||||||
|
{
|
||||||
|
uint32_t val =
|
||||||
|
((uint32_t)data[i * 4 + 0]) |
|
||||||
|
((uint32_t)data[i * 4 + 1] << 8) |
|
||||||
|
((uint32_t)data[i * 4 + 2] << 16) |
|
||||||
|
((uint32_t)data[i * 4 + 3] << 24);
|
||||||
|
std::cout << val;
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Connector::printBytes(uint32_t length, uint8_t *data, uint16_t max)
|
||||||
|
{
|
||||||
|
if (data && length >= 4)
|
||||||
|
{
|
||||||
|
std::cout << " > ";
|
||||||
|
for (size_t i = 0; (i < length) & (i < max); ++i)
|
||||||
|
{
|
||||||
|
std::cout << data[i];
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *Connector::cmdString(int cmd)
|
||||||
|
{
|
||||||
|
for (const ProtocolCmdEntry &entry : protocolCmdList)
|
||||||
|
{
|
||||||
|
if (entry.cmd == cmd)
|
||||||
|
return entry.name;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Connector::printMessage(uint32_t cmd, uint32_t length, uint8_t *data, bool encrypted, bool out)
|
||||||
|
{
|
||||||
|
if (Settings::protocolDebug <= PROTOCOL_DEBUG_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *cmds = cmdString(cmd);
|
||||||
|
|
||||||
|
if (Settings::protocolDebug <= PROTOCOL_DEBUG_UNKNOWN && cmds)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Settings::protocolDebug < PROTOCOL_DEBUG_OUT && out)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool stream = (cmd == CMD_AUDIO_DATA || cmd == CMD_VIDEO_DATA) && length > 50;
|
||||||
|
if (Settings::protocolDebug < PROTOCOL_DEBUG_ALL && stream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
|
||||||
|
oss << (out ? "<" : ">") << (encrypted ? "*" : " ")
|
||||||
|
<< std::setw(3) << std::right << static_cast<unsigned>(cmd)
|
||||||
|
<< std::setw(8) << std::left << ("[" + std::to_string(length) + "]")
|
||||||
|
<< std::setw(15) << std::left << (cmds ? cmds : "Unknown");
|
||||||
|
|
||||||
|
if (data && length > 0)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 50 && i < length; ++i)
|
||||||
|
{
|
||||||
|
char ch = static_cast<char>(data[i]);
|
||||||
|
if (ch == '\n' || ch == '\r')
|
||||||
|
oss << '.';
|
||||||
|
else
|
||||||
|
oss << (std::isprint(static_cast<unsigned char>(ch)) ? ch : '.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << oss.str() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void Connector::read_loop()
|
void Connector::read_loop()
|
||||||
{
|
{
|
||||||
std::mutex mtx;
|
std::mutex mtx;
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
Header header;
|
Header header;
|
||||||
int transferred = 0;
|
int transferred = 0;
|
||||||
uint8_t *data;
|
uint8_t *data = nullptr;
|
||||||
|
|
||||||
// Set thread name
|
// Set thread name
|
||||||
setThreadName("protocol-reader");
|
setThreadName("protocol-reader");
|
||||||
@@ -251,6 +337,10 @@ void Connector::read_loop()
|
|||||||
libusb_bulk_transfer(_device, _endpoint_in, data, header.length, &transferred, READ_TIMEOUT);
|
libusb_bulk_transfer(_device, _endpoint_in, data, header.length, &transferred, READ_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PROTOCOL_DEBUG
|
||||||
|
printMessage(header.type, header.length, data, header.magic == MAGIC_ENC, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!_protocol)
|
if (!_protocol)
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
@@ -262,7 +352,7 @@ void Connector::read_loop()
|
|||||||
|
|
||||||
if (!_cipher)
|
if (!_cipher)
|
||||||
{
|
{
|
||||||
std::cout << "[Connection] Received encrypted command " << header.type <<" but cipher is not initialised" << std::endl;
|
std::cout << "[Connection] Received encrypted command " << header.type << " but cipher is not initialised" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!_cipher->Decrypt(data, header.length))
|
if (!_cipher->Decrypt(data, header.length))
|
||||||
@@ -292,6 +382,7 @@ void Connector::write_loop()
|
|||||||
if (_connected)
|
if (_connected)
|
||||||
{
|
{
|
||||||
status("Initialising dongle");
|
status("Initialising dongle");
|
||||||
|
std::cout << "[Connection] Device connected" << std::endl;
|
||||||
if (_protocol)
|
if (_protocol)
|
||||||
_protocol->onDevice(true);
|
_protocol->onDevice(true);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,12 @@
|
|||||||
#define READ_TIMEOUT 5000
|
#define READ_TIMEOUT 5000
|
||||||
#define ENCRYPTION_BASE "SkBRDy3gmrw1ieH0"
|
#define ENCRYPTION_BASE "SkBRDy3gmrw1ieH0"
|
||||||
|
|
||||||
|
#define PROTOCOL_DEBUG_NONE 0
|
||||||
|
#define PROTOCOL_DEBUG_UNKNOWN 1
|
||||||
|
#define PROTOCOL_DEBUG_NOSTREAM 2
|
||||||
|
#define PROTOCOL_DEBUG_OUT 3
|
||||||
|
#define PROTOCOL_DEBUG_ALL 4
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct Header
|
struct Header
|
||||||
{
|
{
|
||||||
@@ -49,6 +55,11 @@ private:
|
|||||||
|
|
||||||
void status(const char *status);
|
void status(const char *status);
|
||||||
|
|
||||||
|
static void printInts(uint32_t length, uint8_t *data, uint16_t max);
|
||||||
|
static void printBytes(uint32_t length, uint8_t *data, uint16_t max);
|
||||||
|
static const char *cmdString(int cmd);
|
||||||
|
static void printMessage(uint32_t cmd, uint32_t length, uint8_t *data, bool encrypted, bool out);
|
||||||
|
|
||||||
libusb_context *_context = nullptr;
|
libusb_context *_context = nullptr;
|
||||||
libusb_device_handle *_device = nullptr;
|
libusb_device_handle *_device = nullptr;
|
||||||
uint8_t _endpoint_in;
|
uint8_t _endpoint_in;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#define CMD_JSON_CONTROL 25
|
#define CMD_JSON_CONTROL 25
|
||||||
#define CMD_MANUFACTURER 20
|
#define CMD_MANUFACTURER 20
|
||||||
#define CMD_UNKNOWN_38 38
|
#define CMD_UNKNOWN_38 38
|
||||||
|
#define CMD_MEDIA_INFO 42
|
||||||
#define CMD_SEND_FILE 153
|
#define CMD_SEND_FILE 153
|
||||||
#define CMD_UNKNOWN_136 136
|
#define CMD_UNKNOWN_136 136
|
||||||
#define CMD_DAYNIGHT 162
|
#define CMD_DAYNIGHT 162
|
||||||
@@ -48,10 +49,12 @@ const ProtocolCmdEntry protocolCmdList[] = {
|
|||||||
{CMD_DEVICE_LIST, "Device List"},
|
{CMD_DEVICE_LIST, "Device List"},
|
||||||
{CMD_JSON_CONTROL, "Control JSON"},
|
{CMD_JSON_CONTROL, "Control JSON"},
|
||||||
{CMD_MANUFACTURER, "Manufacturer"},
|
{CMD_MANUFACTURER, "Manufacturer"},
|
||||||
|
{CMD_MEDIA_INFO, "Media info"},
|
||||||
{CMD_SEND_FILE, "File"},
|
{CMD_SEND_FILE, "File"},
|
||||||
{CMD_DAYNIGHT, "DeyNight Mode"},
|
{CMD_DAYNIGHT, "DeyNight Mode"},
|
||||||
{CMD_HEARTBEAT, "Heartbeat"},
|
{CMD_HEARTBEAT, "Heartbeat"},
|
||||||
{CMD_VERSION, "Version"},
|
{CMD_VERSION, "Version"},
|
||||||
{CMD_ENCRYPTION, "Encryption"}};
|
{CMD_ENCRYPTION, "Encryption"}};
|
||||||
|
|
||||||
|
|
||||||
#endif /* SRC_HELPER_PROTOCOL_CONST */
|
#endif /* SRC_HELPER_PROTOCOL_CONST */
|
||||||
|
|||||||
+28
-11
@@ -131,9 +131,15 @@ void processKey(Protocol &protocol, SDL_Keysym key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void processEvents(Protocol &protocol)
|
void processEvents(Protocol &protocol, bool processMouse)
|
||||||
{
|
{
|
||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
|
int motionX = -1;
|
||||||
|
int motionY = -1;
|
||||||
|
int downX = -1;
|
||||||
|
int downY = -1;
|
||||||
|
int upX = -1;
|
||||||
|
int upY = -1;
|
||||||
while (SDL_PollEvent(&e))
|
while (SDL_PollEvent(&e))
|
||||||
{
|
{
|
||||||
switch (e.type)
|
switch (e.type)
|
||||||
@@ -145,27 +151,24 @@ void processEvents(Protocol &protocol)
|
|||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
{
|
{
|
||||||
mouseDown = true;
|
mouseDown = true;
|
||||||
int window_width, window_height;
|
downX = e.button.x;
|
||||||
SDL_GetWindowSize(window, &window_width, &window_height);
|
downY = e.button.y;
|
||||||
protocol.sendClick(1.0 * e.button.x / window_width, 1.0 * e.button.y / window_height, true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
{
|
{
|
||||||
mouseDown = false;
|
mouseDown = false;
|
||||||
int window_width, window_height;
|
upX = e.button.x;
|
||||||
SDL_GetWindowSize(window, &window_width, &window_height);
|
upY = e.button.y;
|
||||||
protocol.sendClick(1.0 * e.button.x / window_width, 1.0 * e.button.y / window_height, false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
{
|
{
|
||||||
if (!mouseDown)
|
if (!mouseDown)
|
||||||
break;
|
break;
|
||||||
int window_width, window_height;
|
motionX = e.motion.x;
|
||||||
SDL_GetWindowSize(window, &window_width, &window_height);
|
motionY = e.motion.y;
|
||||||
protocol.sendMove(1.0 * e.motion.x / window_width, 1.0 * e.motion.y / window_height);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
@@ -175,6 +178,18 @@ void processEvents(Protocol &protocol)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(processMouse && (downX>=0 || upX>=0 || motionX>=0))
|
||||||
|
{
|
||||||
|
int window_width, window_height;
|
||||||
|
SDL_GetWindowSize(window, &window_width, &window_height);
|
||||||
|
if(downX>=0)
|
||||||
|
protocol.sendClick(1.0 * downX / window_width, 1.0 * downY / window_height, true);
|
||||||
|
if(motionX>=0)
|
||||||
|
protocol.sendMove(1.0 * motionX / window_width, 1.0 * motionY / window_height);
|
||||||
|
if(upX>=0)
|
||||||
|
protocol.sendClick(1.0 * upX / window_width, 1.0 * upY / window_height, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void application()
|
void application()
|
||||||
@@ -224,7 +239,7 @@ void application()
|
|||||||
while (active)
|
while (active)
|
||||||
{
|
{
|
||||||
Uint32 frameStart = SDL_GetTicks();
|
Uint32 frameStart = SDL_GetTicks();
|
||||||
processEvents(protocol);
|
processEvents(protocol, videoPrepared);
|
||||||
|
|
||||||
if (connected != protocol.phoneConnected)
|
if (connected != protocol.phoneConnected)
|
||||||
{
|
{
|
||||||
@@ -251,6 +266,8 @@ void application()
|
|||||||
SDL_RenderCopy(renderer, videoRenderer.texture, nullptr, nullptr);
|
SDL_RenderCopy(renderer, videoRenderer.texture, nullptr, nullptr);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
}
|
||||||
|
if(frameid!=latestid+1)
|
||||||
|
std::cout << "[Main] Fram drop from " << frameid - latestid - 1 << std::endl;
|
||||||
latestid = frameid;
|
latestid = frameid;
|
||||||
videoBuffer.consume();
|
videoBuffer.consume();
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-74
@@ -24,16 +24,6 @@ Protocol::~Protocol()
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Protocol::cmdString(int cmd)
|
|
||||||
{
|
|
||||||
for (const ProtocolCmdEntry &entry : protocolCmdList)
|
|
||||||
{
|
|
||||||
if (entry.cmd == cmd)
|
|
||||||
return entry.name;
|
|
||||||
}
|
|
||||||
return "Unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
void Protocol::start(StatusCallback onStatus)
|
void Protocol::start(StatusCallback onStatus)
|
||||||
{
|
{
|
||||||
_statusCallback = onStatus;
|
_statusCallback = onStatus;
|
||||||
@@ -197,6 +187,8 @@ void Protocol::onPhone(bool connected)
|
|||||||
return;
|
return;
|
||||||
phoneConnected = connected;
|
phoneConnected = connected;
|
||||||
|
|
||||||
|
std::cout << (connected ? "[Protocol] Phone connected" : "[Protocol] Phone disconnected") << std::endl;
|
||||||
|
|
||||||
if (connected && Settings::onConnect.value.length() > 1)
|
if (connected && Settings::onConnect.value.length() > 1)
|
||||||
execute(Settings::onConnect.value.c_str());
|
execute(Settings::onConnect.value.c_str());
|
||||||
|
|
||||||
@@ -221,7 +213,6 @@ void Protocol::onData(uint32_t cmd, uint32_t length, uint8_t *data)
|
|||||||
{
|
{
|
||||||
if (length <= 13)
|
if (length <= 13)
|
||||||
{
|
{
|
||||||
print_message(cmd, length, data);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
@@ -244,83 +235,22 @@ void Protocol::onData(uint32_t cmd, uint32_t length, uint8_t *data)
|
|||||||
dispose = false;
|
dispose = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
print_message(cmd, length, data);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_PLUGGED:
|
case CMD_PLUGGED:
|
||||||
{
|
|
||||||
onPhone(true);
|
onPhone(true);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case CMD_UNPLUGGED:
|
case CMD_UNPLUGGED:
|
||||||
{
|
|
||||||
onPhone(false);
|
onPhone(false);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case CMD_ENCRYPTION:
|
case CMD_ENCRYPTION:
|
||||||
{
|
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
connector.setEncryption(true);
|
connector.setEncryption(true);
|
||||||
print_message(cmd, length, data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
print_message(cmd, length, data);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dispose && length > 0 && data)
|
if (dispose && length > 0 && data)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Protocol::print_ints(uint32_t length, uint8_t *data, uint16_t max)
|
|
||||||
{
|
|
||||||
if (data && length >= 4)
|
|
||||||
{
|
|
||||||
std::cout << " > ";
|
|
||||||
size_t count = length / 4;
|
|
||||||
for (size_t i = 0; (i < count) & (i < max); ++i)
|
|
||||||
{
|
|
||||||
uint32_t val =
|
|
||||||
((uint32_t)data[i * 4 + 0]) |
|
|
||||||
((uint32_t)data[i * 4 + 1] << 8) |
|
|
||||||
((uint32_t)data[i * 4 + 2] << 16) |
|
|
||||||
((uint32_t)data[i * 4 + 3] << 24);
|
|
||||||
std::cout << val;
|
|
||||||
}
|
|
||||||
std::cout << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Protocol::print_bytes(uint32_t length, uint8_t *data, uint16_t max)
|
|
||||||
{
|
|
||||||
if (data && length >= 4)
|
|
||||||
{
|
|
||||||
std::cout << " > ";
|
|
||||||
for (size_t i = 0; (i < length) & (i < max); ++i)
|
|
||||||
{
|
|
||||||
std::cout << data[i];
|
|
||||||
}
|
|
||||||
std::cout << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Protocol::print_message(uint32_t cmd, uint32_t length, uint8_t *data)
|
|
||||||
{
|
|
||||||
std::cout << "> "
|
|
||||||
<< std::setw(3) << std::right << static_cast<unsigned>(cmd)
|
|
||||||
<< std::setw(8) << std::left << ("[" + std::to_string(length) + "]")
|
|
||||||
<< std::setw(15) << std::left << cmdString(cmd);
|
|
||||||
|
|
||||||
if (data && length > 0)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < 50 && i < length; ++i)
|
|
||||||
{
|
|
||||||
char ch = static_cast<char>(data[i]);
|
|
||||||
std::cout << (std::isprint(static_cast<unsigned char>(ch)) ? ch : '.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "connector.h"
|
#include "connector.h"
|
||||||
|
|
||||||
|
|
||||||
class Protocol : public IProtocol
|
class Protocol : public IProtocol
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -46,10 +45,6 @@ private:
|
|||||||
void onDevice(bool connected) override;
|
void onDevice(bool connected) override;
|
||||||
void onData(uint32_t cmd, uint32_t length, uint8_t *data) override;
|
void onData(uint32_t cmd, uint32_t length, uint8_t *data) override;
|
||||||
|
|
||||||
void print_message(uint32_t cmd, uint32_t length, uint8_t *data);
|
|
||||||
void print_ints(uint32_t length, uint8_t *data, uint16_t max);
|
|
||||||
void print_bytes(uint32_t length, uint8_t *data, uint16_t max);
|
|
||||||
|
|
||||||
void onPhone(bool connected);
|
void onPhone(bool connected);
|
||||||
|
|
||||||
uint16_t _width;
|
uint16_t _width;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
static inline Setting<bool> autoconnect{"autoconnect", true};
|
static inline Setting<bool> autoconnect{"autoconnect", true};
|
||||||
static inline Setting<std::string> onConnect{"on-connect-script", ""};
|
static inline Setting<std::string> onConnect{"on-connect-script", ""};
|
||||||
static inline Setting<std::string> onDisconnect{"on-disconnect-script", ""};
|
static inline Setting<std::string> onDisconnect{"on-disconnect-script", ""};
|
||||||
|
static inline Setting<int> protocolDebug{"protocol-debug", 0};
|
||||||
|
|
||||||
static void load(const std::string &filename);
|
static void load(const std::string &filename);
|
||||||
static void print();
|
static void print();
|
||||||
|
|||||||
Reference in New Issue
Block a user