Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions api/device.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package synapse;

import "api/node.proto";
import "api/status.proto";
import "api/time.proto";

message Peripheral {
enum Type {
Expand Down Expand Up @@ -34,3 +35,28 @@ message DeviceConfiguration {
repeated NodeConfig nodes = 1;
repeated NodeConnection connections = 2;
}


// Device settings that are configurable by the user
message DeviceSettings {
string name = 1;
TimeSource time_source = 2;
}

message GetSettingsQuery {

}

message GetSettingsResponse {
DeviceSettings settings = 1;
}

message UpdateDeviceSettingsRequest {
// If a field isn't populated, it will not be changed
DeviceSettings settings = 1;
}

message UpdateDeviceSettingsResponse {
Status status = 1;
DeviceSettings updated_settings = 2;
}
4 changes: 4 additions & 0 deletions api/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package synapse;
import "api/channel.proto";
import "api/status.proto";
import "api/tap.proto";
import "api/device.proto";

message SampleQuery {
repeated Channel channels = 1;
Expand Down Expand Up @@ -48,13 +49,15 @@ message QueryRequest {
kSample = 2;
kSelfTest = 3;
kListTaps = 4;
kGetSettings = 5;
}
QueryType query_type = 1;
oneof query {
ImpedanceQuery impedance_query = 2;
SampleQuery sample_query = 3;
SelfTestQuery self_test_query = 4;
ListTapsQuery list_taps_query = 5;
GetSettingsQuery get_settings_query = 6;
}
}

Expand All @@ -71,6 +74,7 @@ message QueryResponse {
ImpedanceResponse impedance_response = 3;
SelfTestResponse self_test_response = 4;
ListTapsResponse list_taps_response = 5;
GetSettingsResponse get_settings_response = 6;
}
}

Expand Down
2 changes: 2 additions & 0 deletions api/synapse.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ service SynapseDevice {

rpc GetLogs(LogQueryRequest) returns (LogQueryResponse) {}
rpc TailLogs(TailLogsRequest) returns (stream LogEntry) {}

rpc UpdateDeviceSettings(UpdateDeviceSettingsRequest) returns (UpdateDeviceSettingsResponse) {}
}
14 changes: 14 additions & 0 deletions api/time.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ message TimeSyncPacket {
fixed64 server_send_time_ns = 5;
fixed64 client_receive_time_ns = 6;
}

// Defines the time synchronization method for device timestamps
enum TimeSource {
TIME_SOURCE_UNKNOWN = 0;

// Use std::chrono::steady_clock (monotonic, immune to system time changes)
// Note: The epoch is implementation-defined (often system boot time)
TIME_SOURCE_STEADY_CLOCK = 1;

// Calculate timestamps based on sample counter and sampling rate
// timestamp = (sample_counter / sample_rate) + initial_steady_clock_value
// Where initial_steady_clock_value = get_steady_clock_now() at start
TIME_SOURCE_SAMPLE_COUNTER = 2;
}