-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenControllerLib.proto
More file actions
142 lines (122 loc) · 4.67 KB
/
OpenControllerLib.proto
File metadata and controls
142 lines (122 loc) · 4.67 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Copyright (C) 2022 PJTSearch
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* OpenController Proto
*
* A Protocol Buffer schema representing an OpenController module.
*/
syntax = "proto2";
option java_package = "com.pjtsearch.opencontroller_lib_proto";
option java_multiple_files = true;
option go_package = "pjtsearch.com/opencontroller_lib_proto";
package model;
/** The root message representing a house. **/
message HouseExpr {
required Expr display_name = 1; // The name to be displayed by clients
required Expr id = 2; // A unique identifier
repeated Expr rooms = 3; // The Rooms inside the House
}
/** A message representing a room. */
message RoomExpr {
required Expr id = 1; // A unique id for the room
required Expr display_name = 2; // The name to be displayed by clients
repeated Expr controllers = 3; // The Controllers inside the Room
optional Expr icon = 4; // The icon of the Room to be displayed by clients
}
/** A message representing a controller */
message ControllerExpr {
required Expr id = 1; // A unique id for the controller
required Expr display_name = 2; // The name to be displayed by clients
optional Expr brand_color = 3; // A brand color to be displayed by clients
optional Expr display_interface = 4; // The interface for display clients for the Controller
}
/** A Controller interface for clients with displays */
message DisplayInterfaceExpr {
/**
* The Widgets that make up the controller.
*
* Implementation Notes: The layout of the widgets in the array is flexible for the client.
*/
repeated Expr widgets = 1;
}
/** A message representing a controllable device */
message DeviceExpr {
map<string, Expr> lambdas = 1; // The actions the Device is capable of
}
/** A message representing any controller widget that can be displayed by clients */
message WidgetExpr {
required string widget_type = 2; // The type of widget
map<string, Expr> params = 3; // The parameters to the widget
repeated Expr children = 4; // The children of the widget
}
/** A message representing a reference to the cope */
message RefExpr {
required string ref = 1; // The name of the desired reference in the scope
}
/** A message representing a lambda expression */
message LambdaExpr {
repeated string args = 1; // The args to the lambda
required Expr return = 2; // The return of the lambda
}
/** A message representing a function call */
message CallExpr {
required Expr calling = 1; // The expression to call
repeated Expr args = 2; // The arguments to pass
}
/** A message representing an else-if */
message Elif {
required Expr condition = 1; // The condition to call if
required Expr then = 2; // The expression to call
}
/** A message representing an if expression */
message IfExpr {
required Expr condition = 1; // The condition to call if
required Expr then = 2; // The expression to call
repeated Elif elif = 3; // The else-if conditions
required Expr else = 4; // The else condition
}
/** A message representing the position of an expression in source code */
message Position {
required string file = 1; // The file path
required int32 line = 2; // The line number
required int32 column = 3; // The column number
}
/** A message representing an expression */
message Expr {
/** The position of the expression in the source code */
optional Position position = 1;
/** The type of expression */
oneof inner {
RefExpr ref = 2;
LambdaExpr lambda = 3;
CallExpr call = 4;
string string = 5;
int64 int64 = 6;
int32 int32 = 7;
float float = 8;
bool bool = 9;
HouseExpr house = 10;
RoomExpr room = 11;
ControllerExpr controller = 12;
DisplayInterfaceExpr display_interface = 13;
DeviceExpr device = 14;
WidgetExpr widget = 15;
IfExpr if = 16;
}
}
/** A message representing an OpenController module */
message Module {
map<string, Module> imports = 1; // The imports of the module
required Expr body = 2; // The body of the module
}