Skip to content

Commit

Permalink
[GeothermalResearchInstitute] Update API v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcoona committed Oct 2, 2019
1 parent d401f7f commit 19afa76
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ItemGroup>
<Protobuf Include="../proto/bjdire/v1/authentication.proto" Link="authentication_v1.proto" />
<Protobuf Include="../proto/bjdire/v1/device.proto" Link="device_v1.proto" />
<Protobuf Include="../proto/bjdire/v2/service.proto" Link="service_v2.proto" />
</ItemGroup>

</Project>
56 changes: 46 additions & 10 deletions GeothermalResearchInstitute/proto/bjdire/v2/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ package bjdire.v2;

import "google/protobuf/field_mask.proto";

option csharp_namespace = "GeothermalResearchInstitute.v2";

enum DeviceStatus {
DEVICE_STATUS_INVALID = 0;
DEVICE_STATUS_HEALTHY = 1;
DEVICE_STATUS_UNHEALTHY = 2;
DEVICE_STATUS_UNKNOWN = 3;
}

message Device {
bytes id = 1;
string name = 2;
bytes ipv4_address = 3;
reserved "ipv6_address"; reserved 4;
DeviceStatus status = 5;
}

message Metric {
// 出水温度(摄氏度)
float output_water_celsius_degree = 1;
Expand Down Expand Up @@ -97,30 +114,49 @@ message WorkingMode {
WaterPumpWorkingMode water_pump_working_mode = 3;
}

message GetMetricRequest {}
message ListDevicesRequest {}

message GetSwitchRequest {}
message ListDevicesResponse {
repeated Device devices = 1;
}

message GetMetricRequest {
bytes device_id = 1;
}

message GetSwitchRequest {
bytes device_id = 1;
}

message UpdateSwitchRequest {
Switch switch = 1;
google.protobuf.FieldMask update_mask = 2;
bytes device_id = 1;
Switch switch = 2;
google.protobuf.FieldMask update_mask = 3;
}

message GetRunningParameterRequest {}
message GetRunningParameterRequest {
bytes device_id = 1;
}

message UpdateRunningParameterRequest {
RunningParameter running_parameter = 1;
google.protobuf.FieldMask update_mask = 2;
bytes device_id = 1;
RunningParameter running_parameter = 2;
google.protobuf.FieldMask update_mask = 3;
}

message GetWorkingModeRequest {}
message GetWorkingModeRequest {
bytes device_id = 1;
}

message UpdateWorkingModeRequest {
WorkingMode working_mode = 1;
google.protobuf.FieldMask update_mask = 2;
bytes device_id = 1;
WorkingMode working_mode = 2;
google.protobuf.FieldMask update_mask = 3;
}

service DeviceService {
rpc ListDevices (ListDevicesRequest) returns (ListDevicesResponse) {}

rpc GetMetric (GetMetricRequest) returns (Metric) {}

rpc GetSwitch (GetSwitchRequest) returns (Switch) {}
Expand Down

0 comments on commit 19afa76

Please sign in to comment.