mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-10 21:47:04 +03:00
initial refactoring
This commit is contained in:
8
protobuf/proto/AirPlay.proto
Normal file
8
protobuf/proto/AirPlay.proto
Normal file
@@ -0,0 +1,8 @@
|
||||
syntax = "proto3";
|
||||
import "nanopb.proto";
|
||||
package sys;
|
||||
message AirPlay {
|
||||
option (nanopb_msgopt).msgid = 1001;
|
||||
bool enabled = 1;
|
||||
uint32 port = 2 [(nanopb).int_size = IS_8];
|
||||
}
|
||||
9
protobuf/proto/Artwork.proto
Normal file
9
protobuf/proto/Artwork.proto
Normal file
@@ -0,0 +1,9 @@
|
||||
syntax = "proto3";
|
||||
package sys;
|
||||
import "nanopb.proto";
|
||||
|
||||
message Artwork {
|
||||
option (nanopb_msgopt).msgid = 1002;
|
||||
bool enabled = 1 ; // Enable cover art display
|
||||
bool resize = 2 ; // Optional parameter to indicate if the artwork should be resized
|
||||
}
|
||||
31
protobuf/proto/Battery.proto
Normal file
31
protobuf/proto/Battery.proto
Normal file
@@ -0,0 +1,31 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
enum BatteryChannelEnum {
|
||||
UNSPECIFIED_CH = 0;
|
||||
CH0 = 1;
|
||||
CH1 = 2;
|
||||
CH2 = 3;
|
||||
CH3 = 4;
|
||||
CH4 = 5;
|
||||
CH5 = 6;
|
||||
CH6 = 7;
|
||||
CH7 = 8;
|
||||
}
|
||||
|
||||
enum BatteryAttenEnum {
|
||||
UNSPECIFIED_ATT = 0;
|
||||
ATT_0 = 1;
|
||||
ATT_1 = 2;
|
||||
ATT_2 = 3;
|
||||
ATT_3 = 4;
|
||||
}
|
||||
message Battery {
|
||||
option (nanopb_msgopt).msgid = 1003;
|
||||
BatteryChannelEnum channel = 1;
|
||||
float scale = 2;
|
||||
int32 cells = 3 [(nanopb).int_size = IS_8];
|
||||
BatteryAttenEnum atten = 4;
|
||||
}
|
||||
85
protobuf/proto/Buttons.proto
Normal file
85
protobuf/proto/Buttons.proto
Normal file
@@ -0,0 +1,85 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "GPIO.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum ButtonAction {
|
||||
ACTRLS_NONE = 0;
|
||||
ACTRLS_POWER = 1;
|
||||
ACTRLS_VOLUP = 2;
|
||||
ACTRLS_VOLDOWN = 3;
|
||||
ACTRLS_TOGGLE = 4;
|
||||
ACTRLS_PLAY = 5;
|
||||
ACTRLS_PAUSE = 6;
|
||||
ACTRLS_STOP = 7;
|
||||
ACTRLS_REW = 8;
|
||||
ACTRLS_FWD = 9;
|
||||
ACTRLS_PREV = 10;
|
||||
ACTRLS_NEXT = 11;
|
||||
BCTRLS_UP = 12;
|
||||
BCTRLS_DOWN = 13;
|
||||
BCTRLS_LEFT = 14;
|
||||
BCTRLS_RIGHT = 15;
|
||||
BCTRLS_PS1 = 16;
|
||||
BCTRLS_PS2 = 17;
|
||||
BCTRLS_PS3 = 18;
|
||||
BCTRLS_PS4 = 19;
|
||||
BCTRLS_PS5 = 20;
|
||||
BCTRLS_PS6 = 21;
|
||||
BCTRLS_PS7 = 22;
|
||||
BCTRLS_PS8 = 23;
|
||||
BCTRLS_PS9 = 24;
|
||||
BCTRLS_PS10 = 25;
|
||||
KNOB_LEFT = 26;
|
||||
KNOB_RIGHT = 27;
|
||||
KNOB_PUSH = 28;
|
||||
ACTRLS_SLEEP = 29;
|
||||
}
|
||||
// Message for ButtonActions
|
||||
message ButtonActions {
|
||||
option (nanopb_msgopt).msgid = 10004;
|
||||
ButtonAction pressed = 1 ;
|
||||
ButtonAction released = 2 ;
|
||||
}
|
||||
message Button {
|
||||
option (nanopb_msgopt).msgid = 10005;
|
||||
GPIO gpio = 1;
|
||||
bool pull = 2;
|
||||
int32 debounce = 3;
|
||||
GPIO shifter = 4;
|
||||
int32 longduration = 5;
|
||||
ButtonActions normal = 6;
|
||||
ButtonActions longpress = 7;
|
||||
ButtonActions shifted = 8;
|
||||
ButtonActions longshifted = 9;
|
||||
}
|
||||
message KnobOnly {
|
||||
option (nanopb_msgopt).msgid = 10006;
|
||||
// This mode attempts to offer a single knob full navigation which is a bit contorded due to LMS UI's
|
||||
// principles. Left, Right and Press obey to LMS's navigation rules and especially Press always goes to
|
||||
// lower submenu item, even when navigating in the Music Library. That causes a challenge as there is no
|
||||
// 'Play', 'Back' or 'Pause' button. Workaround are as of below:
|
||||
// - longpress is 'Play'
|
||||
// - double press is 'Back' (Left in LMS's terminology).
|
||||
// - a quick left-right movement on the encoder is 'Pause'
|
||||
//
|
||||
// The speed of double click (or left-right) can be set using the optional parameter of 'knobonly'.
|
||||
// This is not a perfect solution, and other ideas are welcome. Be aware that the longer you set double
|
||||
// click speed, the less responsive the interface will be. The reason is that I need to wait for that
|
||||
// delay before deciding if it's a single or double click. It can also make menu navigation "hesitations"
|
||||
// being easily interpreted as 'Pause'
|
||||
bool enable = 1; // Enable/disable
|
||||
int32 delay_ms = 2; // optionally set the delay
|
||||
|
||||
}
|
||||
message Rotary {
|
||||
option (nanopb_msgopt).msgid = 10007;
|
||||
GPIO A = 1;
|
||||
GPIO B = 2;
|
||||
GPIO SW = 3;
|
||||
KnobOnly knobonly = 4;
|
||||
bool volume = 5;
|
||||
bool longpress = 6;
|
||||
}
|
||||
46
protobuf/proto/CMakeLists.txt
Normal file
46
protobuf/proto/CMakeLists.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
# Append nanopb path to CMAKE_MODULE_PATH for finding the nanopb package
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
include(../protobuf_utils.cmake)
|
||||
configure_env()
|
||||
|
||||
file(GLOB_RECURSE PROTO_FILES *.proto)
|
||||
# set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH ${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_FILES})
|
||||
|
||||
|
||||
# Create a custom target to generate the proto files
|
||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
|
||||
add_custom_target(generate_system_proto DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
|
||||
|
||||
add_library(platform_protobuf STATIC ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
# PUBLIC to propagate includes from bell to cspot dependents
|
||||
target_compile_definitions(platform_protobuf PUBLIC PB_ENABLE_MALLOC)
|
||||
target_compile_definitions(platform_protobuf PUBLIC PB_FIELD_32BIT)
|
||||
target_include_directories(platform_protobuf PUBLIC "include" ${CMAKE_CURRENT_BINARY_DIR} ${NANOPB_INCLUDE_DIRS} ${EXTRA_INCLUDES})
|
||||
|
||||
|
||||
|
||||
# Link the generated proto library to your main targets
|
||||
target_link_libraries(__idf_platform_config PRIVATE platform_protobuf)
|
||||
target_link_libraries(__idf_wifi-manager PRIVATE platform_protobuf)
|
||||
target_include_directories(__idf_platform_config PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/proto)
|
||||
|
||||
|
||||
|
||||
# Add nanopb includes
|
||||
set(CMAKE_INCLUDE_GLOBAL_DIRS ON)
|
||||
|
||||
# include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${NANOPB_INCLUDE_DIRS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I")
|
||||
idf_build_set_property(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} APPEND)
|
||||
foreach(PATH_ENTRY ${NANOPB_INCLUDE_DIRS})
|
||||
idf_build_set_property(INCLUDE_DIRECTORIES ${PATH_ENTRY} APPEND)
|
||||
endforeach()
|
||||
|
||||
set(NANOPB_GENERATOR_SOURCE_DIR "${NANOPB_GENERATOR_SOURCE_DIR}" PARENT_SCOPE)
|
||||
set(PROTO_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/proto;${NANOPB_GENERATOR_SOURCE_DIR}/proto" PARENT_SCOPE)
|
||||
set(PROTO_FILES "${PROTO_FILES}" PARENT_SCOPE)
|
||||
set(PROTO_SRCS "${PROTO_SRCS}" PARENT_SCOPE)
|
||||
set(PROTO_HDRS "${PROTO_HDRS}" PARENT_SCOPE)
|
||||
|
||||
24
protobuf/proto/Common.proto
Normal file
24
protobuf/proto/Common.proto
Normal file
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum DeviceTypeEnum {
|
||||
UNSPECIFIED_TYPE = 0;
|
||||
DEVTYPE_SPI = 1;
|
||||
DEVTYPE_I2C = 2;
|
||||
DEVTYPE__RMII = 3;
|
||||
}
|
||||
|
||||
enum PortEnum {
|
||||
UNSPECIFIED_SYSTPORT = 0;
|
||||
SYSTEM = 1;
|
||||
DAC_PORT = 2;
|
||||
}
|
||||
|
||||
enum HostEnum {
|
||||
UNSPECIFIED_HOST = 0;
|
||||
Host0 = 1;
|
||||
Host1 = 2;
|
||||
}
|
||||
39
protobuf/proto/DAC.proto
Normal file
39
protobuf/proto/DAC.proto
Normal file
@@ -0,0 +1,39 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "GPIO.proto";
|
||||
import "DacControlSet.proto";
|
||||
import "I2CBus.proto";
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum DACModelEnum {
|
||||
UNSPECIFIED_MODEL = 0;
|
||||
TAS57xx = 1;
|
||||
TAS5713 = 2;
|
||||
AC101 = 3;
|
||||
WM8978 = 4;
|
||||
ES8388 = 5;
|
||||
I2S = 6;
|
||||
CS4265 = 7;
|
||||
}
|
||||
enum MCKEnum {
|
||||
UNSPECIFIED_MCK = 0;
|
||||
MCK0 = 1;
|
||||
MCK1 = 2;
|
||||
MCK2 = 3;
|
||||
}
|
||||
|
||||
message DAC {
|
||||
option (nanopb_msgopt).msgid = 10008;
|
||||
GPIO bck = 1 [(cust_field).read_only = true] ;
|
||||
GPIO ws = 2;
|
||||
GPIO dout = 3;
|
||||
MCKEnum mck = 4;
|
||||
GPIO mute = 5;
|
||||
DACModelEnum model = 6;
|
||||
I2CBus i2c = 7;
|
||||
DacControlSet daccontrolset = 8;
|
||||
bool jack_mutes_amp = 9;
|
||||
}
|
||||
63
protobuf/proto/DacControlSet.proto
Normal file
63
protobuf/proto/DacControlSet.proto
Normal file
@@ -0,0 +1,63 @@
|
||||
syntax = "proto3";
|
||||
package sys;
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
message DacControlSet {
|
||||
option (nanopb_msgopt).msgid = 10009;
|
||||
repeated ControlCommand commands = 1 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 10];
|
||||
}
|
||||
|
||||
message ControlCommand {
|
||||
option (nanopb_msgopt).msgid = 10010;
|
||||
ControlCommandType type = 1;
|
||||
repeated ControlItem items = 2 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 50];
|
||||
}
|
||||
|
||||
enum ControlCommandType {
|
||||
INIT = 0;
|
||||
POWER_ON = 1;
|
||||
POWER_OFF = 2;
|
||||
SPEAKER_ON = 3;
|
||||
SPEAKER_OFF = 4;
|
||||
HEADSET_ON = 5;
|
||||
HEADSET_OFF = 6;
|
||||
}
|
||||
|
||||
message ControlItem {
|
||||
option (nanopb_msgopt).msgid = 10011;
|
||||
oneof item_type {
|
||||
RegisterAction reg_action = 1;
|
||||
GpioAction gpio_action = 2;
|
||||
DelayAction delay_action = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message RegisterAction {
|
||||
option (nanopb_msgopt).msgid = 10012;
|
||||
int32 reg = 1[(nanopb).int_size = IS_8];
|
||||
int32 val = 2 [(nanopb).int_size = IS_8];
|
||||
Mode mode = 3;
|
||||
}
|
||||
|
||||
enum GpioActionLevel {
|
||||
ACTION_LEVEL_UNDEFINED = 0;
|
||||
ACTION_LEVEL_1 = 1;
|
||||
ACTION_LEVEL_0 = 2;
|
||||
}
|
||||
message GpioAction {
|
||||
option (nanopb_msgopt).msgid = 10013;
|
||||
int32 gpio = 1 [(nanopb).int_size = IS_8];
|
||||
GpioActionLevel level = 2;
|
||||
}
|
||||
|
||||
message DelayAction {
|
||||
option (nanopb_msgopt).msgid = 10014;
|
||||
int32 delay = 1; // Delay in milliseconds
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
REG_MODE_NOTHING = 0;
|
||||
REG_MODE_OR = 1;
|
||||
REG_MODE_AND = 2;
|
||||
}
|
||||
69
protobuf/proto/Devices.proto
Normal file
69
protobuf/proto/Devices.proto
Normal file
@@ -0,0 +1,69 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "GPIO.proto";
|
||||
import "Common.proto";
|
||||
import "I2CBus.proto";
|
||||
import "DAC.proto";
|
||||
import "Display.proto";
|
||||
import "Buttons.proto";
|
||||
import "Battery.proto";
|
||||
import "Ethernet.proto";
|
||||
import "nanopb.proto";
|
||||
message SPDIF {
|
||||
option (nanopb_msgopt).msgid = 10015;
|
||||
GPIO dc = 1;
|
||||
GPIO data = 2;
|
||||
GPIO clk = 3;
|
||||
}
|
||||
|
||||
|
||||
message SPIBus {
|
||||
option (nanopb_msgopt).msgid = 10016;
|
||||
GPIO mosi = 1;
|
||||
GPIO miso = 2;
|
||||
GPIO clk = 3;
|
||||
GPIO dc = 4;
|
||||
HostEnum host = 5; // Defaults to Host1 in your application logic
|
||||
}
|
||||
enum LEDStripType {
|
||||
LS_UNKNOWN = 0;
|
||||
LS_WS2812 = 1;
|
||||
//unsupported
|
||||
LS_SK6812 = 2;
|
||||
//unsupported
|
||||
LS_APA106 = 3;
|
||||
}
|
||||
|
||||
|
||||
message LEDStrip {
|
||||
option (nanopb_msgopt).msgid = 10018;
|
||||
GPIO gpio = 1;
|
||||
int32 length = 2 [(nanopb).int_size = IS_16];
|
||||
LEDStripType strip_type = 3;
|
||||
}
|
||||
enum InfraredType {
|
||||
IR_UNKNOWN = 0;
|
||||
IR_RC5 = 1;
|
||||
IR_NEC = 2;
|
||||
}
|
||||
message Infrared {
|
||||
InfraredType type = 1;
|
||||
GPIO gpio = 2;
|
||||
}
|
||||
|
||||
message Dev {
|
||||
option (nanopb_msgopt).msgid = 10019;
|
||||
SPIBus spi = 1;
|
||||
I2CBus i2c = 2;
|
||||
DAC dac = 3;
|
||||
SPDIF spdif = 4;
|
||||
Display display = 5;
|
||||
repeated GPIOExp gpio_exp = 6 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 4];
|
||||
LEDStrip led_strip = 7;
|
||||
Rotary rotary = 8;
|
||||
repeated Button buttons = 9 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 15];
|
||||
Eth eth = 10;
|
||||
Battery battery = 11;
|
||||
Infrared ir = 12;
|
||||
}
|
||||
68
protobuf/proto/Display.proto
Normal file
68
protobuf/proto/Display.proto
Normal file
@@ -0,0 +1,68 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "GPIO.proto";
|
||||
import "Common.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
message DispOffsets {
|
||||
option (nanopb_msgopt).msgid = 10020;
|
||||
int32 height =1 [(nanopb).int_size = IS_16];
|
||||
int32 width =2 [(nanopb).int_size = IS_16];
|
||||
}
|
||||
|
||||
enum DisplayDriverEnum {
|
||||
UNSPECIFIED_DRIVER = 0;
|
||||
SSD1306 = 1;
|
||||
SSD1322 = 2;
|
||||
SSD1326 = 3;
|
||||
SSD1327 = 4;
|
||||
SH1106 = 5;
|
||||
SSD1675 = 6;
|
||||
ST7735 = 7;
|
||||
ST7789 = 8;
|
||||
ILI9341 = 9;
|
||||
ILI9341_24 = 10;
|
||||
SSD1351 = 11;
|
||||
}
|
||||
|
||||
|
||||
message I2CDisplay {
|
||||
option (nanopb_msgopt).msgid = 10021;
|
||||
int32 address = 1 [(nanopb).int_size = IS_8];
|
||||
}
|
||||
|
||||
message SPIDisplay {
|
||||
option (nanopb_msgopt).msgid = 10022;
|
||||
GPIO cs = 1;
|
||||
int32 speed = 4 ;
|
||||
}
|
||||
|
||||
|
||||
message DispCommon {
|
||||
option (nanopb_msgopt).msgid = 10023;
|
||||
int32 width = 1 [(nanopb).int_size = IS_16];
|
||||
int32 height = 2 [(nanopb).int_size = IS_16];
|
||||
bool HFlip = 3;
|
||||
bool VFlip = 4;
|
||||
DisplayDriverEnum driver = 5;
|
||||
int32 bitDepth = 6 [(nanopb).int_size = IS_8]; // Defaults to Depth1 in your application logic
|
||||
GPIO back = 7;
|
||||
GPIO reset = 8;
|
||||
GPIO ready = 9;
|
||||
DispOffsets offsets = 10;
|
||||
bool rotate = 11;
|
||||
bool invert = 12;
|
||||
bool colow_swap = 13;
|
||||
}
|
||||
|
||||
message Display {
|
||||
option (nanopb_msgopt).msgid = 10024;
|
||||
DeviceTypeEnum type = 1;
|
||||
DispCommon common = 2;
|
||||
oneof dispType {
|
||||
I2CDisplay i2c = 3;
|
||||
SPIDisplay spi = 4;
|
||||
}
|
||||
}
|
||||
10
protobuf/proto/Equalizer.proto
Normal file
10
protobuf/proto/Equalizer.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
|
||||
import "nanopb.proto";
|
||||
|
||||
message Equalizer {
|
||||
repeated float gains = 1 [(nanopb).max_count = 10];
|
||||
float loudness = 2;
|
||||
}
|
||||
52
protobuf/proto/Ethernet.proto
Normal file
52
protobuf/proto/Ethernet.proto
Normal file
@@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "Common.proto";
|
||||
import "GPIO.proto";
|
||||
import "nanopb.proto";
|
||||
import "customoptions.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum EthModelEnum {
|
||||
UNSPECIFIED_ETHMODEL = 0;
|
||||
LAN8720 = 1;
|
||||
DM9051 = 2;
|
||||
W5500 = 3;
|
||||
}
|
||||
enum EthType { // This enum is used to define the union type for Eth
|
||||
UNSPECIFIED_ETH = 0; // for unspecified type
|
||||
SPI = 1;
|
||||
RMII = 2;
|
||||
}
|
||||
message EthCommon {
|
||||
option (nanopb_msgopt).msgid = 10025;
|
||||
EthModelEnum model = 1;
|
||||
GPIO rst = 2;
|
||||
}
|
||||
|
||||
// SPI Specific Ethernet definitions
|
||||
message EthSPI {
|
||||
option (nanopb_msgopt).msgid = 10026;
|
||||
GPIO cs = 1; // CS pin
|
||||
int32 speed = 2 [(nanopb).int_size = IS_16]; // SPI Bus speed
|
||||
GPIO intr = 3;
|
||||
int32 host = 4 [(nanopb).int_size = IS_8,(cust_field).v_int32 = 2 ]; // Defaults to 2 in your application logic
|
||||
}
|
||||
|
||||
// RMII Specific Ethernet definitions
|
||||
message EthRMII {
|
||||
option (nanopb_msgopt).msgid = 10027;
|
||||
GPIO mdc = 1;
|
||||
GPIO mdio = 2;
|
||||
}
|
||||
|
||||
// Ethernet module configuration
|
||||
message Eth {
|
||||
option (nanopb_msgopt).msgid = 10028;
|
||||
DeviceTypeEnum type = 1;
|
||||
EthCommon common = 2;
|
||||
oneof ethType {
|
||||
EthSPI spi = 3;
|
||||
EthRMII rmii = 4;
|
||||
}
|
||||
}
|
||||
73
protobuf/proto/GPIO.proto
Normal file
73
protobuf/proto/GPIO.proto
Normal file
@@ -0,0 +1,73 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "Common.proto";
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum LevelsEnum {
|
||||
L_LOW = 0;
|
||||
L_HIGH = 1;
|
||||
}
|
||||
// GPIO to use for the specified function
|
||||
message GPIO {
|
||||
option (nanopb_msgopt).msgid = 10130;
|
||||
int32 pin = 1 [(nanopb).int_size = IS_8, (cust_field).v_int32 = -1]; // a valid esp32 gpio pin that supports the intended mode
|
||||
LevelsEnum level = 2 [(cust_field).v_enum = "L_HIGH"]; // 0 or 1
|
||||
}
|
||||
enum LedTypesEnum {
|
||||
UNKNOWN = 0;
|
||||
LED_TYPE_GPIO = 1;
|
||||
LED_TYPE_WS2812 = 2;
|
||||
}
|
||||
message LED {
|
||||
option (nanopb_msgopt).msgid = 10029;
|
||||
GPIO gpio = 1 [(nanopb).int_size = IS_8]; // a valid esp32 gpio pin that supports the intended mode
|
||||
int32 brightness = 2 [(nanopb).int_size = IS_8]; // 0 to 100%
|
||||
LedTypesEnum led_type = 3;
|
||||
}
|
||||
message Gpios {
|
||||
option (nanopb_msgopt).msgid = 10030;
|
||||
LED greenLED = 1;
|
||||
LED redLED = 2;
|
||||
GPIO audioJack = 3;
|
||||
GPIO amp = 4;
|
||||
GPIO power = 5 ;
|
||||
GPIO jack = 6;
|
||||
GPIO spkfault = 7;
|
||||
GPIO Vcc = 8;
|
||||
GPIO GND = 9;
|
||||
}
|
||||
enum GPIOExpModelEnum {
|
||||
UNSPECIFIED_EXP = 0;
|
||||
PCA9535 = 1;
|
||||
PCA85XX = 2;
|
||||
MCP23017 = 3;
|
||||
MCP23S17 = 4;
|
||||
}
|
||||
|
||||
message GPIOExpI2C {
|
||||
option (nanopb_msgopt).msgid = 10032;
|
||||
PortEnum port = 5 [(cust_field).v_string = "SYSTEM"]; // Defaults to system
|
||||
}
|
||||
message GPIOExpSPI {
|
||||
option (nanopb_msgopt).msgid = 10031;
|
||||
int32 speed = 1 [(nanopb).int_size = IS_16];
|
||||
HostEnum host = 2;
|
||||
GPIO cs = 3;
|
||||
}
|
||||
message GPIOExp {
|
||||
option (nanopb_msgopt).msgid = 10033;
|
||||
GPIOExpModelEnum model = 1;
|
||||
int32 addr = 2 [(nanopb).int_size = IS_8];
|
||||
oneof ExpType {
|
||||
GPIOExpI2C i2c = 3;
|
||||
GPIOExpSPI spi = 4;
|
||||
}
|
||||
int32 base = 5 [(cust_field).v_int32 = 40]; // Defaults to 40
|
||||
int32 count = 6 [(cust_field).v_int32 = 16]; // Defaults to 16
|
||||
GPIO intr = 7;
|
||||
|
||||
|
||||
}
|
||||
19
protobuf/proto/I2CBus.proto
Normal file
19
protobuf/proto/I2CBus.proto
Normal file
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
import "GPIO.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
enum I2CPortEnum {
|
||||
UNSPECIFIED_PORT = 0;
|
||||
I2CPort0 = 1;
|
||||
I2CPort1 = 2;
|
||||
}
|
||||
message I2CBus {
|
||||
option (nanopb_msgopt).msgid = 10034;
|
||||
I2CPortEnum port = 1 ;
|
||||
int32 speed = 2 [(nanopb).int_size = IS_16];
|
||||
GPIO sda = 3;
|
||||
GPIO scl = 4;
|
||||
}
|
||||
25
protobuf/proto/Names.proto
Normal file
25
protobuf/proto/Names.proto
Normal file
@@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
// Main system configuration definition. This gets loaded in a pointer
|
||||
// named platform-> which is available across the build
|
||||
message Names {
|
||||
option (cust_msg).init_from_mac = true;
|
||||
option (cust_msg).const_prefix = "squeezelite-";
|
||||
option (nanopb_msgopt).max_length= 128;
|
||||
// Network device name
|
||||
string device = 1 ;
|
||||
// AirPlay device name
|
||||
string airplay = 2;
|
||||
// Spotify device name
|
||||
string spotify = 3;
|
||||
// Bluetooth player name advertized
|
||||
string bluetooth = 4;
|
||||
// Player name reported to the Logitech Media Server
|
||||
string squeezelite = 5;
|
||||
// Wifi Access Point name
|
||||
string wifi_ap_name = 6;
|
||||
}
|
||||
74
protobuf/proto/Network.proto
Normal file
74
protobuf/proto/Network.proto
Normal file
@@ -0,0 +1,74 @@
|
||||
syntax = "proto3";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
|
||||
package sys;
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
enum WifiAuthTypeEnum{
|
||||
AUTH_UNKNOWN = 0;
|
||||
AUTH_OPEN = 1;
|
||||
AUTH_WEP = 2;
|
||||
AUTH_WPA_PSK = 3;
|
||||
AUTH_WPA2_PSK = 4;
|
||||
AUTH_WPA_WPA2_PSK = 5;
|
||||
AUTH_WPA2_ENTERPRISE = 6;
|
||||
AUTH_WPA3_PSK = 7;
|
||||
AUTH_WPA2_WPA3_PSK = 8;
|
||||
AUTH_WAPI_PSK = 9;
|
||||
}
|
||||
enum WifiRadioTypesEnum {
|
||||
PHY_UNKNOWN = 0;
|
||||
PHY_11B = 1;
|
||||
PHY_11G = 2;
|
||||
PHY_11N = 3;
|
||||
PHY_LR = 4;
|
||||
PHY_WPS = 5;
|
||||
PHY_FTM_RESPONDER = 6;
|
||||
PHY_FTM_INITIATOR = 7;
|
||||
}
|
||||
|
||||
message IP {
|
||||
option (nanopb_msgopt).msgid = 10051;
|
||||
string ip = 14 [(nanopb).max_length = 15];
|
||||
string netmask = 15 [(nanopb).max_length = 15];
|
||||
string gw = 16 [(nanopb).max_length = 15];
|
||||
}
|
||||
|
||||
message WifiSTAEntry {
|
||||
string ssid = 1 [(nanopb).max_length = 32];
|
||||
string bssid = 2 [(nanopb).max_length = 32];
|
||||
uint32 channel = 3 [(nanopb).int_size = IS_8]; /**< channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
|
||||
WifiAuthTypeEnum auth_type = 4;
|
||||
WifiRadioTypesEnum radio_type = 5;
|
||||
google.protobuf.Timestamp last_try = 6;
|
||||
google.protobuf.Timestamp last_seen = 7;
|
||||
bool connected = 8;
|
||||
string password = 9 [(nanopb).max_length = 64];
|
||||
uint32 rssi = 10 [(nanopb).max_length = 8];
|
||||
}
|
||||
message WifiAP {
|
||||
IP ip = 1;
|
||||
string password = 2 [(nanopb).max_length = 64];
|
||||
uint32 channel = 3 [(nanopb).int_size = IS_8]; /**< channel of Access point AP. */
|
||||
WifiAuthTypeEnum auth_mode = 4 [(cust_field).v_enum = "AUTH_WPA2_PSK"];
|
||||
bool hidden = 5;
|
||||
// Max allowed connections. 4 is recommended
|
||||
uint32 max_connection = 6 [(nanopb).int_size = IS_8];
|
||||
// Recommended value: 100
|
||||
uint32 beacon_interval = 7 [(nanopb).int_size = IS_16];
|
||||
}
|
||||
message Server {
|
||||
option (nanopb_msgopt).msgid = 10050;
|
||||
int32 cport = 1;
|
||||
int32 port = 2;
|
||||
string ip = 3 [(nanopb).max_length = 15];
|
||||
}
|
||||
message NetworkConfig {
|
||||
bool disable_dhcp = 1;
|
||||
IP manual_ip = 2;
|
||||
// Wifi Credentials
|
||||
repeated WifiSTAEntry credentials = 3 [ (nanopb).max_count = 5 ];
|
||||
WifiAP ap = 4;
|
||||
WifiSTAEntry last_connected = 5 ;
|
||||
}
|
||||
76
protobuf/proto/Services.proto
Normal file
76
protobuf/proto/Services.proto
Normal file
@@ -0,0 +1,76 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
|
||||
import "GPIO.proto";
|
||||
import "Artwork.proto";
|
||||
import "Spotify.proto";
|
||||
import "AirPlay.proto";
|
||||
import "Squeezelite.proto";
|
||||
import "Equalizer.proto";
|
||||
import "nanopb.proto";
|
||||
import "customoptions.proto";
|
||||
|
||||
// Configuration for sleep service
|
||||
message SleepService {
|
||||
option (nanopb_msgopt).msgid = 10035;
|
||||
// Inactivity in minutes before going to sleep
|
||||
uint32 delay = 1;
|
||||
|
||||
// Inactivity delay in minutes after which sleep resumes
|
||||
int32 spurious = 2 [(nanopb).int_size = IS_16];
|
||||
|
||||
// GPIO for sleep
|
||||
GPIO sleep = 3;
|
||||
|
||||
// List of GPIOs that will cause the system to wake up
|
||||
repeated GPIO wake = 4 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 10];
|
||||
|
||||
// List of RTC GPIOs to keep active
|
||||
repeated GPIO rtc = 5 [(nanopb).type = FT_POINTER]; //[(nanopb).max_count= 10];
|
||||
|
||||
// Threshold in volts under which the system will enter into sleep
|
||||
float batt = 6;
|
||||
}
|
||||
message Telnet {
|
||||
bool enable = 1;
|
||||
uint32 block = 2 [(nanopb).int_size = IS_16];
|
||||
uint32 buffer = 3 [(nanopb).int_size = IS_16];
|
||||
|
||||
}
|
||||
message Metadata {
|
||||
option (nanopb_msgopt).msgid = 10036;
|
||||
// Optional parameters controlling bluetooth and airplay
|
||||
// Display format with optional keywords %artist%, %album%, %title%
|
||||
string format = 1 [(nanopb).max_length= 50];
|
||||
|
||||
// Scrolling speed in ms
|
||||
uint32 speed = 2 ;
|
||||
|
||||
// Pause time between scrolls in ms
|
||||
uint32 pause = 3;
|
||||
|
||||
// Cover art display configuration
|
||||
Artwork artwork = 4;
|
||||
}
|
||||
|
||||
message BluetoothSink {
|
||||
bool enabled = 1;
|
||||
uint32 volume = 2;
|
||||
string pin = 3 [(nanopb).max_length = 16,(cust_field).v_string = "0000" ];
|
||||
|
||||
}
|
||||
|
||||
message Services {
|
||||
option (nanopb_msgopt).msgid = 10037;
|
||||
Metadata metadata = 1;
|
||||
SleepService sleep = 2;
|
||||
Spotify cspot = 4;
|
||||
AirPlay airplay = 5;
|
||||
Squeezelite squeezelite = 6;
|
||||
string release_url = 7 [(nanopb).max_length = 256, (cust_field).v_string = "https://api.github.com/repos/sle118/squeezelite-esp32/releases"];
|
||||
BluetoothSink bt_sink = 8;
|
||||
bool statistics = 9 [(cust_field).v_bool = false];
|
||||
Telnet telnet = 10;
|
||||
Equalizer equalizer = 11;
|
||||
}
|
||||
11
protobuf/proto/Spotify.proto
Normal file
11
protobuf/proto/Spotify.proto
Normal file
@@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
package sys;
|
||||
message Spotify {
|
||||
option (nanopb_msgopt).msgid = 10038;
|
||||
bool enabled = 1;
|
||||
uint32 bitrate = 2 [(nanopb).int_size = IS_16];
|
||||
bool zeroconf = 3 [(cust_field).v_bool = true] ;
|
||||
uint32 volume = 4 ;
|
||||
}
|
||||
127
protobuf/proto/Squeezelite.proto
Normal file
127
protobuf/proto/Squeezelite.proto
Normal file
@@ -0,0 +1,127 @@
|
||||
syntax = "proto3";
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
package sys;
|
||||
enum OutputTypeEnum {
|
||||
OUTPUT_UNKNOWN = 0;
|
||||
OUTPUT_I2S = 1;
|
||||
OUTPUT_SPDIF = 2;
|
||||
OUTPUT_Bluetooth = 3;
|
||||
}
|
||||
message OutputBT {
|
||||
option (nanopb_msgopt).msgid = 10039;
|
||||
string sink_name = 1 [(nanopb).max_length= 128];
|
||||
string pin = 2 [(nanopb).max_length= 16];
|
||||
}
|
||||
// Enum for the type of resampling algorithm
|
||||
enum ResampleAlgorithm {
|
||||
RA_DISABLED = 0;
|
||||
RA_BASIC_LINEAR = 1; // Basic linear interpolation
|
||||
RA_THIRTEEN_TAPS = 2; // 13 taps
|
||||
RA_TWENTY_ONE_TAPS = 3; // 21 taps
|
||||
}
|
||||
|
||||
// ResampleOptions represents the resampling options for Squeezelite
|
||||
message ResampleOptions {
|
||||
option (nanopb_msgopt).msgid = 10040;
|
||||
ResampleAlgorithm algorithm = 1; // The resampling algorithm to use
|
||||
bool interpolate_filter_coefficients = 2; // Whether to interpolate filter coefficients
|
||||
}
|
||||
|
||||
enum SampleRate {
|
||||
SAMPLE_RATE_UNSPECIFIED = 0; // Default value, can be used to represent an unspecified rate
|
||||
SAMPLE_RATE_8000 = 8000;
|
||||
SAMPLE_RATE_11025 = 11025;
|
||||
SAMPLE_RATE_12000 = 12000;
|
||||
SAMPLE_RATE_16000 = 16000;
|
||||
SAMPLE_RATE_22050 = 22050;
|
||||
SAMPLE_RATE_24000 = 24000;
|
||||
SAMPLE_RATE_32000 = 32000;
|
||||
SAMPLE_RATE_44100 = 44100;
|
||||
SAMPLE_RATE_48000 = 48000;
|
||||
SAMPLE_RATE_88200 = 88200;
|
||||
SAMPLE_RATE_96000 = 96000;
|
||||
SAMPLE_RATE_176400 = 176400;
|
||||
SAMPLE_RATE_192000 = 192000;
|
||||
SAMPLE_RATE_352800 = 352800;
|
||||
SAMPLE_RATE_384000 = 384000;
|
||||
SAMPLE_RATE_705600 = 705600;
|
||||
SAMPLE_RATE_768000 = 768000;
|
||||
}
|
||||
enum DebugLevelEnum {
|
||||
DEFAULT = 0;
|
||||
ERROR = 1;
|
||||
WARN = 2;
|
||||
INFO = 3;
|
||||
DEBUG = 4;
|
||||
SDEBUG = 5;
|
||||
}
|
||||
enum CodexEnum {
|
||||
c_undefined = 0;
|
||||
c_alac = 1;
|
||||
c_ogg = 2;
|
||||
c_ops = 3;
|
||||
c_flac = 4;
|
||||
c_pcm = 5;
|
||||
c_mp3 = 6;
|
||||
c_mad = 7;
|
||||
c_mpg = 8;
|
||||
}
|
||||
message RatesOption {
|
||||
option (nanopb_msgopt).msgid = 10041;
|
||||
SampleRate min = 1;
|
||||
SampleRate max = 2;
|
||||
repeated SampleRate list = 3 [(nanopb).type = FT_POINTER]; // [(nanopb).max_count= 10];
|
||||
}
|
||||
message BufferOption {
|
||||
option (nanopb_msgopt).msgid = 10042;
|
||||
uint32 stream = 1 [(cust_field).v_uint32 = 500];
|
||||
uint32 output = 2 [(cust_field).v_uint32 = 2000];
|
||||
}
|
||||
message DebugOptions {
|
||||
DebugLevelEnum output = 1 [(cust_field).v_string = "WARN"];
|
||||
DebugLevelEnum stream = 2 [(cust_field).v_string = "WARN"];
|
||||
DebugLevelEnum decode = 3 [(cust_field).v_string = "WARN"];
|
||||
DebugLevelEnum slimproto = 4 [(cust_field).v_string = "WARN"];
|
||||
DebugLevelEnum ir = 5 [(cust_field).v_string = "WARN"];
|
||||
}
|
||||
|
||||
message Squeezelite {
|
||||
option (nanopb_msgopt).msgid = 10044;
|
||||
// Output device configuration
|
||||
OutputTypeEnum output_type = 1 [(cust_field).v_string = "OUTPUT_I2S"];
|
||||
|
||||
// Sample rates supported
|
||||
RatesOption rates = 2;
|
||||
|
||||
// Timeout (seconds) for switching off amp GPIO
|
||||
// default is to keep the device 'on' all the time
|
||||
int32 amp_gpio_timeout = 3 [(cust_field).v_int32 = 30];
|
||||
|
||||
// tRead wave and aiff format from header, ignore server parameters
|
||||
bool wav_aiff_header_parsing = 4;
|
||||
|
||||
// Server connection options
|
||||
string server_name_ip = 5 [(nanopb).max_length= 128];
|
||||
uint32 server_port = 6;
|
||||
|
||||
// Allow disabling squeezelite to use the
|
||||
// device in "detached mode"
|
||||
bool enabled = 7;
|
||||
|
||||
OutputBT output_bt = 8;
|
||||
|
||||
// enable debugging here
|
||||
DebugOptions log = 9 ;
|
||||
|
||||
// Max sample rate reported to server
|
||||
uint32 max_rate = 10;
|
||||
|
||||
BufferOption buffers = 11;
|
||||
string resample = 12 [(nanopb).type = FT_POINTER];
|
||||
repeated CodexEnum included_codex = 13 [(nanopb).type = FT_POINTER];
|
||||
repeated CodexEnum excluded_codex = 14 [(nanopb).type = FT_POINTER];
|
||||
|
||||
}
|
||||
16
protobuf/proto/State.proto
Normal file
16
protobuf/proto/State.proto
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
package sys;
|
||||
import "Network.proto";
|
||||
import "Equalizer.proto";
|
||||
import "nanopb.proto";
|
||||
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
|
||||
message State {
|
||||
WifiSTAEntry connected_sta = 1;
|
||||
Server lms = 2;
|
||||
string ota_url = 3 [(nanopb).type = FT_POINTER];
|
||||
string cspot_credentials = 4 [(nanopb).type = FT_POINTER];
|
||||
int32 bt_sink_volume = 5 ;
|
||||
Equalizer equalizer = 6;
|
||||
}
|
||||
125
protobuf/proto/Status.proto
Normal file
125
protobuf/proto/Status.proto
Normal file
@@ -0,0 +1,125 @@
|
||||
syntax = "proto3";
|
||||
package sys;
|
||||
import "Network.proto";
|
||||
import "nanopb.proto";
|
||||
|
||||
option (nanopb_fileopt).enum_to_string = true;
|
||||
// Enum for APP_AV_STATE
|
||||
enum CONNECTED_IF {
|
||||
IF_UNKNOWN = 0;
|
||||
IF_WIFI = 1;
|
||||
IF_ETHERNET = 2;
|
||||
}
|
||||
enum AV_STATE {
|
||||
A_IDLE = 0;
|
||||
A_DISCOVERING = 1;
|
||||
A_DISCOVERED = 2;
|
||||
A_UNCONNECTED = 3;
|
||||
A_CONNECTING = 4;
|
||||
A_CONNECTED = 5;
|
||||
A_DISCONNECTING = 6;
|
||||
}
|
||||
enum MEDIA_STATE {
|
||||
M_IDLE = 0;
|
||||
M_STARTING = 1;
|
||||
M_STARTED = 2;
|
||||
M_STOPPING = 3;
|
||||
M_WAIT_DISCONNECT = 4;
|
||||
}
|
||||
enum UPDATE_REASONS {
|
||||
R_UNKNOWN = 0;
|
||||
R_CONNECTION_OK = 1;
|
||||
R_FAILED_ATTEMPT = 2;
|
||||
R_USER_DISCONNECT = 3;
|
||||
R_LOST_CONNECTION = 4;
|
||||
R_FAILED_ATTEMPT_AND_RESTORE = 5;
|
||||
R_ETHERNET_CONNECTED = 6;
|
||||
}
|
||||
// Enum for ESP_AVRC_CT
|
||||
enum ESP_AVRC_CT {
|
||||
ESP_AVRC_CT_CONNECTION_STATE_EVT = 0;
|
||||
ESP_AVRC_CT_PASSTHROUGH_RSP_EVT = 1;
|
||||
ESP_AVRC_CT_METADATA_RSP_EVT = 2;
|
||||
ESP_AVRC_CT_PLAY_STATUS_RSP_EVT = 3;
|
||||
ESP_AVRC_CT_CHANGE_NOTIFY_EVT = 4;
|
||||
ESP_AVRC_CT_REMOTE_FEATURES_EVT = 5;
|
||||
ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT = 6;
|
||||
ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT = 7;
|
||||
}
|
||||
enum NetworkStates {
|
||||
NET_UNKNOWN = 0;
|
||||
NET_INSTANTIATED = 1;
|
||||
NET_INITIALIZING = 2;
|
||||
NET_ETH_ACTIVE = 3;
|
||||
NET_WIFI_ACTIVE = 4;
|
||||
NET_WIFI_CONFIGURING_ACTIVE = 5;
|
||||
}
|
||||
enum EthStates {
|
||||
ETH_UNKNOWN = 0;
|
||||
ETH_STARTING = 1;
|
||||
ETH_ACTIVE_LINKUP = 2;
|
||||
ETH_ACTIVE_LINKDOWN = 3;
|
||||
ETH_ACTIVE_CONNECTED = 4;
|
||||
ETH_CONNECTING_NEW = 5;
|
||||
}
|
||||
enum WifiState {
|
||||
WIFI_UNKNOWN = 0;
|
||||
WIFI_INITIALIZING = 1;
|
||||
WIFI_CONNECTING = 2;
|
||||
WIFI_CONNECTING_NEW = 3;
|
||||
WIFI_CONNECTING_NEW_FAILED = 4;
|
||||
WIFI_CONNECTED = 5;
|
||||
WIFI_USER_DISCONNECTED = 6;
|
||||
WIFI_LOST_CONNECTION = 7;
|
||||
}
|
||||
|
||||
|
||||
message WIFI {
|
||||
option (nanopb_msgopt).msgid = 10052;
|
||||
WifiSTAEntry connected_sta = 1;
|
||||
int32 disconnect_count = 2;
|
||||
float avg_conn_time = 3;
|
||||
repeated WifiSTAEntry scan_result = 4 [ (nanopb).type = FT_POINTER ];
|
||||
WifiState wifi_state = 5;
|
||||
}
|
||||
message NET {
|
||||
option (nanopb_msgopt).msgid = 10053;
|
||||
WIFI wifi = 1;
|
||||
IP ip = 2;
|
||||
NetworkStates network_state = 5;
|
||||
EthStates eth_state = 6;
|
||||
bool eth_up = 7;
|
||||
UPDATE_REASONS updt_reason = 8;
|
||||
CONNECTED_IF interface = 9;
|
||||
|
||||
}
|
||||
message BT {
|
||||
option (nanopb_msgopt).msgid = 10054;
|
||||
AV_STATE bt_status = 1;
|
||||
ESP_AVRC_CT bt_sub_status = 2;
|
||||
MEDIA_STATE bt_media_state = 3;
|
||||
}
|
||||
message PLATFORM {
|
||||
option (nanopb_msgopt).msgid = 10055;
|
||||
string project = 1 [(nanopb).max_length = 128];
|
||||
string version = 2 [(nanopb).max_length = 25];
|
||||
bool recovery = 3;
|
||||
string name = 4 [(nanopb).max_length = 55];
|
||||
int32 depth = 5;
|
||||
}
|
||||
message HW {
|
||||
option (nanopb_msgopt).msgid = 10056;
|
||||
bool jack_inserted = 1;
|
||||
float batt_voltage = 2;
|
||||
bool has_jack_inserted = 3;
|
||||
bool spk_fault = 4;
|
||||
bool has_spk_fault = 5;
|
||||
}
|
||||
message Status {
|
||||
option (nanopb_msgopt).msgid = 10057;
|
||||
PLATFORM platform = 1;
|
||||
HW hw = 2;
|
||||
BT bt = 3;
|
||||
Server LMS = 4;
|
||||
NET net = 5;
|
||||
}
|
||||
42
protobuf/proto/configuration.proto
Normal file
42
protobuf/proto/configuration.proto
Normal file
@@ -0,0 +1,42 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package sys;
|
||||
|
||||
import "Services.proto";
|
||||
import "GPIO.proto";
|
||||
import "Devices.proto";
|
||||
import "Names.proto";
|
||||
import "Network.proto";
|
||||
import "customoptions.proto";
|
||||
import "nanopb.proto";
|
||||
|
||||
|
||||
// Main configuration structure
|
||||
message Config {
|
||||
|
||||
// Provides the global name for the pointer to
|
||||
// protoc plugins
|
||||
option (cust_msg).global_name = "platform->";
|
||||
option (nanopb_msgopt).msgid = 1000;
|
||||
|
||||
// GPIO structure definition with leds, etc
|
||||
Gpios gpios = 1;
|
||||
|
||||
// Device tree with SPI, I2C, SPDIF, Display, etc
|
||||
Dev dev = 2;
|
||||
|
||||
// Platform services definition with options
|
||||
Services services = 3 ;
|
||||
|
||||
// Main device name used for networking, etc. Services which
|
||||
// need a name typically has the option to overwrite its own name
|
||||
Names names = 4;
|
||||
|
||||
// Hardware platform (e.g. SqueezeAMP, MUSE, etc.)
|
||||
string platform = 5 [(nanopb).type = FT_POINTER];
|
||||
|
||||
NetworkConfig net = 6;
|
||||
string target = 7 [(nanopb).max_length = 55];
|
||||
|
||||
}
|
||||
|
||||
43
protobuf/proto/customoptions.proto
Normal file
43
protobuf/proto/customoptions.proto
Normal file
@@ -0,0 +1,43 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
import "nanopb.proto";
|
||||
|
||||
// Extend the field options
|
||||
message CustomOptions {
|
||||
bool init_from_mac = 50001; // Unique identifier for the option
|
||||
string const_prefix = 50002 [(nanopb).type = FT_POINTER]; // Unique identifier for the option
|
||||
bool read_only = 50003;
|
||||
oneof default_value {
|
||||
string v_string = 50050 [(nanopb).type = FT_POINTER];
|
||||
uint32 v_uint32 = 50051;
|
||||
int32 v_int32 = 50052;
|
||||
uint64 v_uint64 = 50053;
|
||||
int64 v_int64 = 50054;
|
||||
double v_double = 50055;
|
||||
float v_float = 50056;
|
||||
bool v_bool = 50057;
|
||||
string v_enum = 50058 [(nanopb).type = FT_POINTER];
|
||||
bytes v_bytes = 50059 [(nanopb).type = FT_POINTER];
|
||||
}
|
||||
|
||||
string global_name = 50005 [(nanopb).type = FT_POINTER];
|
||||
}
|
||||
|
||||
|
||||
extend google.protobuf.FileOptions {
|
||||
optional CustomOptions cust_file = 2010;
|
||||
}
|
||||
|
||||
|
||||
extend google.protobuf.MessageOptions {
|
||||
optional CustomOptions cust_msg = 2010;
|
||||
}
|
||||
|
||||
extend google.protobuf.EnumOptions {
|
||||
optional CustomOptions cust_enum = 2010;
|
||||
}
|
||||
|
||||
extend google.protobuf.FieldOptions {
|
||||
optional CustomOptions cust_field = 2010;
|
||||
}
|
||||
144
protobuf/proto/google/protobuf/timestamp.proto
Normal file
144
protobuf/proto/google/protobuf/timestamp.proto
Normal file
@@ -0,0 +1,144 @@
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
// https://developers.google.com/protocol-buffers/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package google.protobuf;
|
||||
|
||||
option cc_enable_arenas = true;
|
||||
option go_package = "google.golang.org/protobuf/types/known/timestamppb";
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "TimestampProto";
|
||||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "GPB";
|
||||
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
||||
|
||||
// A Timestamp represents a point in time independent of any time zone or local
|
||||
// calendar, encoded as a count of seconds and fractions of seconds at
|
||||
// nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
// January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
// Gregorian calendar backwards to year one.
|
||||
//
|
||||
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
// second table is needed for interpretation, using a [24-hour linear
|
||||
// smear](https://developers.google.com/time/smear).
|
||||
//
|
||||
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
// restricting to that range, we ensure that we can convert to and from [RFC
|
||||
// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
//
|
||||
// # Examples
|
||||
//
|
||||
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(time(NULL));
|
||||
// timestamp.set_nanos(0);
|
||||
//
|
||||
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
//
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(tv.tv_sec);
|
||||
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
//
|
||||
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
//
|
||||
// FILETIME ft;
|
||||
// GetSystemTimeAsFileTime(&ft);
|
||||
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
//
|
||||
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
//
|
||||
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
//
|
||||
// long millis = System.currentTimeMillis();
|
||||
//
|
||||
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
//
|
||||
// Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
//
|
||||
// Instant now = Instant.now();
|
||||
//
|
||||
// Timestamp timestamp =
|
||||
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
// .setNanos(now.getNano()).build();
|
||||
//
|
||||
// Example 6: Compute Timestamp from current time in Python.
|
||||
//
|
||||
// timestamp = Timestamp()
|
||||
// timestamp.GetCurrentTime()
|
||||
//
|
||||
// # JSON Mapping
|
||||
//
|
||||
// In JSON format, the Timestamp type is encoded as a string in the
|
||||
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
// where {year} is always expressed using four digits while {month}, {day},
|
||||
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
// is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
// able to accept both UTC and other timezones (as indicated by an offset).
|
||||
//
|
||||
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
// 01:30 UTC on January 15, 2017.
|
||||
//
|
||||
// In JavaScript, one can convert a Date object to this format using the
|
||||
// standard
|
||||
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
// method. In Python, a standard `datetime.datetime` object can be converted
|
||||
// to this format using
|
||||
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
// ) to obtain a formatter capable of generating timestamps in this format.
|
||||
//
|
||||
message Timestamp {
|
||||
// Represents seconds of UTC time since Unix epoch
|
||||
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
// 9999-12-31T23:59:59Z inclusive.
|
||||
int64 seconds = 1;
|
||||
|
||||
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
// second values with fractions must still have non-negative nanos values
|
||||
// that count forward in time. Must be from 0 to 999,999,999
|
||||
// inclusive.
|
||||
int32 nanos = 2;
|
||||
}
|
||||
2
protobuf/proto/requirements.txt
Normal file
2
protobuf/proto/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
mypy-protobuf
|
||||
importlib
|
||||
Reference in New Issue
Block a user