-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdevice.pb.go
427 lines (374 loc) · 14.7 KB
/
device.pb.go
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: device.proto
/*
Package pb is a generated protocol buffer package.
It is generated from these files:
device.proto
It has these top-level messages:
ID
UpdateDevice
Device
Devices
Empty
*/
package pb
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "google.golang.org/genproto/googleapis/api/annotations"
import _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Device_DeviceType int32
const (
Device_unknown Device_DeviceType = 0
Device_onOff Device_DeviceType = 1
Device_dimmer Device_DeviceType = 2
Device_sensor Device_DeviceType = 3
)
var Device_DeviceType_name = map[int32]string{
0: "unknown",
1: "onOff",
2: "dimmer",
3: "sensor",
}
var Device_DeviceType_value = map[string]int32{
"unknown": 0,
"onOff": 1,
"dimmer": 2,
"sensor": 3,
}
func (x Device_DeviceType) String() string {
return proto.EnumName(Device_DeviceType_name, int32(x))
}
func (Device_DeviceType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} }
type ID struct {
Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
}
func (m *ID) Reset() { *m = ID{} }
func (m *ID) String() string { return proto.CompactTextString(m) }
func (*ID) ProtoMessage() {}
func (*ID) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ID) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
type UpdateDevice struct {
Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
Value int32 `protobuf:"varint,2,opt,name=value" json:"value,omitempty"`
}
func (m *UpdateDevice) Reset() { *m = UpdateDevice{} }
func (m *UpdateDevice) String() string { return proto.CompactTextString(m) }
func (*UpdateDevice) ProtoMessage() {}
func (*UpdateDevice) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *UpdateDevice) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
func (m *UpdateDevice) GetValue() int32 {
if m != nil {
return m.Value
}
return 0
}
type Device struct {
Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
Hardware string `protobuf:"bytes,2,opt,name=hardware" json:"hardware,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
Location string `protobuf:"bytes,4,opt,name=location" json:"location,omitempty"`
Type Device_DeviceType `protobuf:"varint,5,opt,name=type,enum=pb.Device_DeviceType" json:"type,omitempty"`
Unit string `protobuf:"bytes,6,opt,name=unit" json:"unit,omitempty"`
State int32 `protobuf:"varint,7,opt,name=state" json:"state,omitempty"`
}
func (m *Device) Reset() { *m = Device{} }
func (m *Device) String() string { return proto.CompactTextString(m) }
func (*Device) ProtoMessage() {}
func (*Device) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *Device) GetId() int32 {
if m != nil {
return m.Id
}
return 0
}
func (m *Device) GetHardware() string {
if m != nil {
return m.Hardware
}
return ""
}
func (m *Device) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Device) GetLocation() string {
if m != nil {
return m.Location
}
return ""
}
func (m *Device) GetType() Device_DeviceType {
if m != nil {
return m.Type
}
return Device_unknown
}
func (m *Device) GetUnit() string {
if m != nil {
return m.Unit
}
return ""
}
func (m *Device) GetState() int32 {
if m != nil {
return m.State
}
return 0
}
type Devices struct {
Device []*Device `protobuf:"bytes,1,rep,name=device" json:"device,omitempty"`
}
func (m *Devices) Reset() { *m = Devices{} }
func (m *Devices) String() string { return proto.CompactTextString(m) }
func (*Devices) ProtoMessage() {}
func (*Devices) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *Devices) GetDevice() []*Device {
if m != nil {
return m.Device
}
return nil
}
type Empty struct {
}
func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func init() {
proto.RegisterType((*ID)(nil), "pb.ID")
proto.RegisterType((*UpdateDevice)(nil), "pb.UpdateDevice")
proto.RegisterType((*Device)(nil), "pb.Device")
proto.RegisterType((*Devices)(nil), "pb.Devices")
proto.RegisterType((*Empty)(nil), "pb.Empty")
proto.RegisterEnum("pb.Device_DeviceType", Device_DeviceType_name, Device_DeviceType_value)
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for DeviceService service
type DeviceServiceClient interface {
// List all registered devices
GetAllDevices(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Devices, error)
// Get a device by ID
GetDeviceByID(ctx context.Context, in *ID, opts ...grpc.CallOption) (*Device, error)
// Update a device's state
SwitchDevice(ctx context.Context, in *UpdateDevice, opts ...grpc.CallOption) (*Device, error)
// Register a new device
RegisterDevice(ctx context.Context, in *Device, opts ...grpc.CallOption) (*Device, error)
}
type deviceServiceClient struct {
cc *grpc.ClientConn
}
func NewDeviceServiceClient(cc *grpc.ClientConn) DeviceServiceClient {
return &deviceServiceClient{cc}
}
func (c *deviceServiceClient) GetAllDevices(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Devices, error) {
out := new(Devices)
err := grpc.Invoke(ctx, "/pb.DeviceService/GetAllDevices", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceServiceClient) GetDeviceByID(ctx context.Context, in *ID, opts ...grpc.CallOption) (*Device, error) {
out := new(Device)
err := grpc.Invoke(ctx, "/pb.DeviceService/GetDeviceByID", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceServiceClient) SwitchDevice(ctx context.Context, in *UpdateDevice, opts ...grpc.CallOption) (*Device, error) {
out := new(Device)
err := grpc.Invoke(ctx, "/pb.DeviceService/SwitchDevice", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceServiceClient) RegisterDevice(ctx context.Context, in *Device, opts ...grpc.CallOption) (*Device, error) {
out := new(Device)
err := grpc.Invoke(ctx, "/pb.DeviceService/RegisterDevice", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for DeviceService service
type DeviceServiceServer interface {
// List all registered devices
GetAllDevices(context.Context, *Empty) (*Devices, error)
// Get a device by ID
GetDeviceByID(context.Context, *ID) (*Device, error)
// Update a device's state
SwitchDevice(context.Context, *UpdateDevice) (*Device, error)
// Register a new device
RegisterDevice(context.Context, *Device) (*Device, error)
}
func RegisterDeviceServiceServer(s *grpc.Server, srv DeviceServiceServer) {
s.RegisterService(&_DeviceService_serviceDesc, srv)
}
func _DeviceService_GetAllDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).GetAllDevices(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.DeviceService/GetAllDevices",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).GetAllDevices(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceService_GetDeviceByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ID)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).GetDeviceByID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.DeviceService/GetDeviceByID",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).GetDeviceByID(ctx, req.(*ID))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceService_SwitchDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateDevice)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).SwitchDevice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.DeviceService/SwitchDevice",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).SwitchDevice(ctx, req.(*UpdateDevice))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceService_RegisterDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Device)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).RegisterDevice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.DeviceService/RegisterDevice",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).RegisterDevice(ctx, req.(*Device))
}
return interceptor(ctx, in, info, handler)
}
var _DeviceService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.DeviceService",
HandlerType: (*DeviceServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetAllDevices",
Handler: _DeviceService_GetAllDevices_Handler,
},
{
MethodName: "GetDeviceByID",
Handler: _DeviceService_GetDeviceByID_Handler,
},
{
MethodName: "SwitchDevice",
Handler: _DeviceService_SwitchDevice_Handler,
},
{
MethodName: "RegisterDevice",
Handler: _DeviceService_RegisterDevice_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "device.proto",
}
func init() { proto.RegisterFile("device.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 610 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x72, 0xd3, 0x30,
0x14, 0x85, 0xb1, 0xf3, 0x47, 0x6f, 0x7f,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