-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathitd.proto
124 lines (98 loc) · 2.54 KB
/
itd.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
syntax = "proto3";
package rpc;
option go_package = "go.arsenm.dev/itd/internal/rpc";
message Empty {};
message IntResponse {
uint32 value = 1;
}
message StringResponse {
string value = 1;
}
message MotionResponse {
int32 x = 1;
int32 y = 2;
int32 z = 3;
}
message NotifyRequest {
string title = 1;
string body = 2;
}
message SetTimeRequest {
int64 unix_nano = 1;
}
message FirmwareUpgradeRequest {
enum Type {
Archive = 0;
Files = 1;
}
Type type = 1;
repeated string files = 2;
}
message DFUProgress {
int64 sent = 1;
int64 recieved = 2;
int64 total = 3;
}
service ITD {
rpc HeartRate(Empty) returns (IntResponse);
rpc WatchHeartRate(Empty) returns (stream IntResponse);
rpc BatteryLevel(Empty) returns (IntResponse);
rpc WatchBatteryLevel(Empty) returns (stream IntResponse);
rpc Motion(Empty) returns (MotionResponse);
rpc WatchMotion(Empty) returns (stream MotionResponse);
rpc StepCount(Empty) returns (IntResponse);
rpc WatchStepCount(Empty) returns (stream IntResponse);
rpc Version(Empty) returns (StringResponse);
rpc Address(Empty) returns (StringResponse);
rpc Notify(NotifyRequest) returns (Empty);
rpc SetTime(SetTimeRequest) returns (Empty);
rpc WeatherUpdate(Empty) returns (Empty);
rpc FirmwareUpgrade(FirmwareUpgradeRequest) returns (stream DFUProgress);
}
message PathRequest {
string path = 1;
}
message PathsRequest {
repeated string paths = 1;
}
message RenameRequest {
string from = 1;
string to = 2;
}
message TransferRequest {
string source = 1;
string destination = 2;
}
message FileInfo {
string name = 1;
int64 size = 2;
bool is_dir = 3;
}
message DirResponse {
repeated FileInfo entries = 1;
}
message TransferProgress {
uint32 sent = 1;
uint32 total = 2;
}
message ResourceLoadProgress {
enum Operation {
Upload = 0;
RemoveObsolete = 1;
}
string name = 1;
int64 total = 2;
int64 sent = 3;
Operation operation = 4;
}
service FS {
rpc RemoveAll(PathsRequest) returns (Empty);
rpc Remove(PathsRequest) returns (Empty);
rpc Rename(RenameRequest) returns (Empty);
rpc MkdirAll(PathsRequest) returns (Empty);
rpc Mkdir(PathsRequest) returns (Empty);
rpc ReadDir(PathRequest) returns (DirResponse);
rpc Upload(TransferRequest) returns (stream TransferProgress);
rpc Download(TransferRequest) returns (stream TransferProgress);
rpc LoadResources(PathRequest) returns (stream ResourceLoadProgress);
}