blob: 9e0bf2ed1b2a542893f6886fc39f31e69760db7d [file] [log] [blame]
// Copyright 2024 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
syntax = "proto3";
package pubsub;
import "pw_protobuf_protos/common.proto";
import "morse_code.proto";
import "state_manager.proto";
service PubSub {
rpc Publish(Event) returns (pw.protobuf.Empty);
rpc Subscribe(pw.protobuf.Empty) returns (stream Event);
}
message LedValue {
uint32 r = 1;
uint32 g = 2;
uint32 b = 3;
}
message MorseCodeValue {
bool turn_on = 1;
bool message_finished = 2;
}
message MorseEncodeRequest {
string msg = 1;
uint32 repeat = 2;
}
message TimerRequest {
uint32 token = 1;
uint32 timeout_s = 2;
}
message TimerExpired {
uint32 token = 1;
}
message StateManagerControl {
enum Action {
UNKNOWN = 0;
INCREMENT_THRESHOLD = 1;
DECREMENT_THRESHOLD = 2;
SILENCE_ALARMS = 3;
}
Action action = 1;
}
message Event {
// This definition must be kept up to date with
// modules/pubsub/pubsub_events.h.
oneof type {
bool button_a_pressed = 1;
bool button_b_pressed = 2;
bool button_x_pressed = 3;
bool button_y_pressed = 4;
bool proximity = 5;
uint32 proximity_level = 6;
uint32 air_quality = 7;
MorseCodeValue morse_code_value = 8;
TimerRequest timer_request = 9;
TimerExpired timer_expired = 10;
morse_code.SendRequest morse_encode_request = 11;
float ambient_light_lux = 12;
state_manager.State sense_state = 13;
StateManagerControl state_manager_control = 14;
}
}