// 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 blinky;

import "pw_protobuf_protos/common.proto";

service Blinky {
  // Toggles the LED on or off.
  // If a previous `Blink` request is still running, stops it before toggling.
  rpc ToggleLed(pw.protobuf.Empty) returns (pw.protobuf.Empty);

  // Sets the LED on or off.
  rpc SetLed(SetLedRequest) returns (pw.protobuf.Empty);

  // Continuously blinks the board LED a specified number of times.
  rpc Blink(BlinkRequest) returns (pw.protobuf.Empty);

  // Returns true or false if LED blinking is idle.
  rpc IsIdle(pw.protobuf.Empty) returns (BlinkIdleResponse);
}

message SetLedRequest {
  bool on = 1;
}

message BlinkIdleResponse {
  bool is_idle = 1;
}

message BlinkRequest {
  // The interval at which to blink or pulse the LED, in milliseconds.
  uint32 interval_ms = 1;

  // The number of times to blink the LED.
  // If unset, blinks forever.
  // If 0, stops blinking.
  optional uint32 blink_count = 2;
}
