Files
trail-mate/platform/linux/common/include/app/linux_phone_protocol.h
T
Trail Mate Dev 6e613e382e Add CM0 Linux support and share device services across platforms
Compose the CM0 fullscreen application and standard Debian package, align the
Cardputer Zero shell, and share protocol, configuration, audio and storage
services with embedded targets through existing platform seams.

Add the paginated on-device TMAP creator using Center's published producer,
private workspace recovery and direct keyboard shortcuts. Preserve unfinished
management work behind its existing opt-in capability.

Include native, ARM and shared-core regression fixtures, integration records,
packaging helpers and dependency/license updates. Keep local build trees,
device credentials, produced packages and validation logs outside version control.

Validation before integration: ESP stack hygiene, Reticulum scope guard, staged
whitespace checks and GitNexus scope audit. Prior device/build evidence and
remaining hardware/package boundaries are recorded in the acceptance documents.
2026-10-29 10:29:29 +08:00

43 lines
1.6 KiB
C++

#pragma once
#include "platform/linux/bluez_phone_gatt.h"
#include <array>
#include <memory>
namespace trailmate::linux_app
{
class LinuxAppServices;
// Shared phone sessions run on the application thread. Transport requests must be
// marshalled here by the worker; no application configuration crosses threads.
class LinuxPhoneProtocol
{
public:
struct Notification
{
uint64_t token = 0;
platform::linux_runtime::PhoneGattChannel channel{};
std::vector<uint8_t> bytes;
};
explicit LinuxPhoneProtocol(LinuxAppServices& services);
~LinuxPhoneProtocol();
LinuxPhoneProtocol(const LinuxPhoneProtocol&) = delete;
LinuxPhoneProtocol& operator=(const LinuxPhoneProtocol&) = delete;
bool supports(platform::linux_runtime::PhoneGattProtocol) const;
bool pairingOptions(platform::linux_runtime::BluezPhoneGattOptions&) const;
const std::string& pairingError() const;
void setPairingDisplay(const platform::linux_runtime::PhonePairingDisplay&);
bool connect(platform::linux_runtime::PhoneGattProtocol, const std::array<uint8_t, 6>& device_mac);
void disconnect();
void subscribe(platform::linux_runtime::PhoneGattChannel, bool enabled);
bool read(platform::linux_runtime::PhoneGattChannel, std::vector<uint8_t>&);
bool write(platform::linux_runtime::PhoneGattChannel, const std::vector<uint8_t>&);
void pump();
bool nextNotification(Notification& out);
void commitNotification(uint64_t token);
bool takeDisconnectRequest();
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace trailmate::linux_app