Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit aa1aca4

Browse files
committed
补充定义,还差 ota 和 channel
1 parent 81f8c78 commit aa1aca4

File tree

6 files changed

+122
-0
lines changed

6 files changed

+122
-0
lines changed

rpc/channel.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package rpc

rpc/device.go

+12
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,42 @@ type DeviceItem struct {
1111
Station map[string]any `json:"station,omitempty"`
1212
}
1313

14+
type DeviceListRequest struct{}
15+
1416
type DeviceListResponse []DeviceItem
1517

1618
type DeviceCreateRequest DeviceItem
1719

20+
type DeviceCreateResponse struct{}
21+
1822
type DeviceDeleteRequest DeviceId
1923

24+
type DeviceDeleteResponse struct{}
25+
2026
type DevicePropertyRequest struct {
2127
Id string `json:"id"`
2228
ProductId string `json:"product_id,omitempty"`
2329
Properties map[string]any `json:"properties"`
2430
}
2531

32+
type DevicePropertyResponse struct{}
33+
2634
type DevicePropertyModifyRequest struct {
2735
Id string `json:"id"`
2836
Properties map[string]any `json:"properties"`
2937
}
3038

39+
type DevicePropertyModifyResponse struct{}
40+
3141
type DeviceEventRequest struct {
3242
Id string `json:"id"`
3343
Name string `json:"name,omitempty"`
3444
Type string `json:"type,omitempty"`
3545
Level int `json:"level,omitempty"`
3646
}
3747

48+
type DeviceEventResponse struct{}
49+
3850
type DeviceActionRequest struct {
3951
Id string `json:"id"`
4052
Name string `json:"name"`

rpc/fs.go

+8
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,19 @@ type FsUploadResponse FsStream
3434

3535
type FsDeleteRequest FsPath
3636

37+
type FsDeleteResponse struct{}
38+
3739
type FsMoveRequest FsPathMove
3840

41+
type FsMoveResponse struct{}
42+
3943
type FsMakeDirectoryRequest FsPath
4044

45+
type FsMakeDirectoryResponse struct{}
46+
4147
type FsFormatRequest struct {
4248
Disk string `json:"disk"`
4349
Type string `json:"type"`
4450
}
51+
52+
type FsFormatResponse struct{}

rpc/gateway.go

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package rpc
2+
3+
type GatewayStatusRequest struct {
4+
Battery int `json:"battery,omitempty"`
5+
Rssi int `json:"rssi,omitempty"`
6+
Cpu int `json:"cpu,omitempty"`
7+
Mem int `json:"mem,omitempty"`
8+
}
9+
10+
type GatewayStatusResponse struct{}
11+
12+
type GatewayEventRequest struct {
13+
Name string `json:"name,omitempty"`
14+
Type string `json:"type,omitempty"`
15+
Level int `json:"level,omitempty"`
16+
}
17+
18+
type GatewaySettingRequest struct {
19+
Server string `json:"server,omitempty"`
20+
Port uint16 `json:"port,omitempty"`
21+
}
22+
23+
type GatewaySettingResponse struct{}
24+
25+
type GatewayMetricsRequest struct{}
26+
27+
type GatewayMetricsResponse struct {
28+
Modules []string `json:"modules,omitempty"`
29+
Os string `json:"os,omitempty"`
30+
Platform string `json:"platform,omitempty"`
31+
Kernel string `json:"kernel,omitempty"`
32+
Boot int64 `json:"boot,omitempty"`
33+
Cpu GatewayMetricsCpu `json:"cpu"`
34+
Memory GatewayMetricsMemory `json:"memory"`
35+
Network []GatewayMetricsNetwork `json:"network,omitempty"`
36+
Disk []GatewayMetricsDisk `json:"disk,omitempty"`
37+
}
38+
39+
type GatewayMetricsCpu struct {
40+
Cores int `json:"cores,omitempty"`
41+
Usage int `json:"usage,omitempty"`
42+
Mhz int `json:"mhz,omitempty"`
43+
Model string `json:"model,omitempty"`
44+
}
45+
type GatewayMetricsMemory struct {
46+
Total int `json:"total,omitempty"`
47+
Free int `json:"free,omitempty"`
48+
Used int `json:"used,omitempty"`
49+
Usage int `json:"usage,omitempty"`
50+
}
51+
52+
type GatewayMetricsNetwork struct {
53+
Name string `json:"name,omitempty"`
54+
Mac string `json:"mac,omitempty"`
55+
Flags []string `json:"flags,omitempty"`
56+
Address []string `json:"address,omitempty"`
57+
Tx int `json:"tx,omitempty"`
58+
Rx int `json:"rx,omitempty"`
59+
}
60+
61+
type GatewayMetricsDisk struct {
62+
Name string `json:"name,omitempty"`
63+
Mount string `json:"mount,omitempty"`
64+
Type string `json:"type,omitempty"`
65+
Total int `json:"total,omitempty"`
66+
Free int `json:"free,omitempty"`
67+
Used int `json:"used,omitempty"`
68+
Usage int `json:"usage,omitempty"`
69+
}

rpc/ota.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package rpc

rpc/product.go

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package rpc
2+
3+
type ProductId struct {
4+
Id string `json:"id"`
5+
}
6+
7+
type ProductItem struct {
8+
Id string `json:"id"`
9+
Name string `json:"name"`
10+
Version string `json:"version"`
11+
}
12+
13+
type ProductStream struct {
14+
Stream uint16 `json:"stream"`
15+
}
16+
17+
type ProductListRequest struct{}
18+
19+
type ProductListResponse []ProductItem
20+
21+
type ProductDownloadRequest ProductId
22+
23+
type ProductDownloadResponse ProductStream
24+
25+
type ProductUploadRequest ProductId
26+
27+
type ProductUploadResponse ProductStream
28+
29+
type ProductDeleteRequest ProductId
30+
31+
type ProductDeleteResponse struct{}

0 commit comments

Comments
 (0)