-
Notifications
You must be signed in to change notification settings - Fork 3
API V2 #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
API V2 #133
Changes from 9 commits
0f315fe
c20cd1c
d472b77
b165561
8122ce2
c084ee3
5a60b07
b590556
4daacdc
a8e116a
37b3662
e66fc45
2167089
022f697
06cdc87
ae5776a
607f0d5
ff5c50c
16212ea
14e0bd8
3e143b6
ad1c24b
f82f3ed
64b22c0
4fbe457
70fd758
bc7da7c
84a84e4
2ed822f
80d9087
78e779a
228b4ad
3842dde
f54f72a
acfecee
5ca77b5
602ed0f
160f1a5
12294b5
df8d141
23462dd
1e80338
f387420
59fce06
89e4e3a
531a560
fb33b84
30fe4ce
98e6155
a6629b7
f8b9a47
a916c40
cdff283
a50b4e9
6650b70
ad0562c
465b38c
ac90d7a
a039075
4597768
9ff9a00
eaf41c6
5c16874
0e9c582
7203b07
f36e486
e251bde
70a62e8
4a1eb83
2543248
242e102
97ea185
dae03b8
3e0c895
76686af
ec9f83d
71f6a5a
8280531
f7058f9
99d9506
dd2f23d
9572a14
005ca9e
1f21e45
cc68216
55bfedb
de9a2ab
c8fb3ee
780e0be
88298aa
5b87251
61c374d
b3e7a06
f7dc28f
92a4ec0
f25d0b3
b3e7376
c2a03c3
2161c98
1a9a526
6cfd568
6f48b50
9182706
1740a0b
9502b64
4f73190
c3419f2
1039c9a
be8529d
606da68
20de684
735ee97
4b755bb
05965d9
520f2fa
54a1aaa
0e4a90c
5a549cc
9671307
b63eb49
70e154e
e6f84dd
7d3cca7
7ae93dd
ee1df09
7dd0fe6
1006031
00ee250
bed8b12
e9aedfc
d2788d2
6ccf0b0
52c4252
3f629fb
218793e
26510b3
f065985
9d11d0d
d71ad53
c165d94
370b739
5539f64
ad775e4
0d6a5ff
36c008c
1d37ef4
734dd60
2ef3b7c
0a74dc9
9704f83
b20a5d0
31c6906
a5cadbf
13325a9
ed54f4d
e1112c5
31d646d
d12a792
8d6fcab
c6334b8
1a08875
2aec8f6
969a60b
e6b79ff
4bd2f75
517e1de
578f208
627652b
492e3a0
4e42234
5f3ec33
cca78c8
09bf58e
be3dc9d
850d73c
20cff93
0ee620d
478e51b
aee75b7
607702e
6811f7b
3a7d109
2aad669
d0fbb8d
d54396c
6b71dc3
4770cd7
2afb042
4ba1574
8eb4a0a
768d607
9f61c41
dc4517e
415b329
6b6d86d
4904d4e
5ff730a
c1c2baa
fcf755f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries | ||
| // SPDX-License-Identifier: MIT | ||
| syntax = "proto3"; | ||
|
|
||
| package wippersnapper.analogio.v1; | ||
| import "nanopb/nanopb.proto"; | ||
| import "wippersnapper/sensor/v1/sensor.proto"; | ||
|
|
||
| message AnalogIOAdd { | ||
| int32 gpio_num = 1; // correlates with `name` in the JSON | ||
| float period = 2; | ||
| AnalogReadMode read_mode = 3; | ||
|
|
||
| /** | ||
| * Selects the type of value read by an analog pin. | ||
| * PIN_VALUE: Raw ADC reading. | ||
| * PIN_VOLTAGE: Calculated voltage reading. | ||
| */ | ||
| enum AnalogReadMode { | ||
| ANALOG_READ_MODE_UNSPECIFIED = 0; | ||
| ANALOG_READ_MODE_PIN_VALUE = 1; | ||
| ANALOG_READ_MODE_PIN_VOLTAGE = 2; | ||
| } | ||
| } | ||
|
|
||
| message AnalogIORemove { | ||
| int32 gpio_num = 1; // correlates with `name` in the JSON | ||
| } | ||
|
|
||
|
|
||
| message AnalogIOEvent { | ||
| int32 gpio_num = 1; // correlates with `name` in the JSON | ||
| wippersnapper.sensor.v1.SensorEvent sensor_event = 2[(nanopb).max_count = 15]; /** A, optionally repeated, SensorEvent from a sensor. */ | ||
brentru marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,36 +10,20 @@ import "nanopb/nanopb.proto"; | |
| * CreateDescriptionRequest identifies a device with Adafruit.io WipperSnapper. | ||
| */ | ||
| message CreateDescriptionRequest { | ||
|
||
| string machine_name = 1 [(nanopb).max_size = 64]; /** Identifies client's physical hardware */ | ||
| int32 mac_addr = 2; /** Client's UID, last 3 bytes of MAC address */ | ||
| int32 usb_vid = 3; /** Optional, USB Vendor ID */ | ||
| int32 usb_pid = 4; /** Optional, USB Product ID */ | ||
| Version version = 5 [deprecated = true, (nanopb).type = FT_IGNORE]; /** Client's library version. */ | ||
| int32 ver_major = 10 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_minor = 11 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_patch = 12 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| string ver_pre_release = 13 [deprecated = true, (nanopb).type = FT_IGNORE, (nanopb).max_size = 6]; | ||
| int32 ver_build = 14 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| string str_version = 15 [(nanopb).max_size = 20]; /** Library version, as a string */ | ||
|
|
||
|
|
||
| message Version { | ||
| uint64 major = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| uint64 minor = 2 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| uint64 micro = 3 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| string label = 4 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_major = 5 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_minor = 6 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_patch = 7 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| string ver_pre_release = 8 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| int32 ver_build = 9 [deprecated = true, (nanopb).type = FT_IGNORE]; | ||
| } | ||
| string str_version = 1 [(nanopb).max_size = 20]; /** Library version, as a string */ | ||
| } | ||
|
|
||
| // TODO: Consider dropping this, and compiling these as a header file (per-board) from the | ||
| // JSON if it is possible to do so. | ||
|
|
||
| // This is handled within decodeRegistrationResp(). We would like to drop it completely. | ||
| // TODO: Try the new esp32 function sto detect totoal gpio, analog and reference | ||
| // If that works, we can try to remove WipperSnapper_Register.cpp entirely and use the esp32 func | ||
| // to detect on ESP32 platforms, otherwise add these values into _Boards.h | ||
| /** | ||
| * CreateDescriptionResponse represents a device's specifications. | ||
| * CreateDescription represents a device's specifications. | ||
| */ | ||
| message CreateDescriptionResponse { | ||
| message CreateDescription { | ||
| Response response = 1; /** Specifies if the hardware definition exists on the server. */ | ||
|
||
| int32 total_gpio_pins = 2; /** Specifies the number of GPIO pins on the client's physical hardware. */ | ||
| int32 total_analog_pins = 3; /** Specifies the number of analog pins on the client's physical hardware. */ | ||
|
|
@@ -63,15 +47,3 @@ message CreateDescriptionResponse { | |
| message RegistrationComplete { | ||
| bool is_complete = 1; /** True if device successfully configured its components, False otherwise. */ | ||
| } | ||
|
|
||
| // Request the board definition JSON from a device | ||
| // MQTT Topic: `device/ID/description/get` | ||
| message GetDefinitionRequest { | ||
| string data = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; // Request may be any UTF-8 string value | ||
| } | ||
|
|
||
| // Response from Adafruit IO with the JSON board definition as a string | ||
| // MQTT Topic: `device/ID/description/get` | ||
| message GetDefinitionResponse { | ||
| string board_definition = 1 [deprecated = true, (nanopb).type = FT_IGNORE]; // Response is JSON data encoded as a string | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries | ||
| // SPDX-License-Identifier: MIT | ||
| syntax = "proto3"; | ||
|
|
||
| package wippersnapper.digitalio.v1; | ||
| import "nanopb/nanopb.proto"; | ||
|
|
||
| // DigitalInput is a digital input pin. | ||
brentru marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| message DigitalIOAdd { | ||
| int32 gpio_num = 1; // correlates with `name` in the JSON | ||
| DigitalIODirection gpio_direction = 2; | ||
| float period = 3; /** Optionally specifies the time between measurements, in seconds. */ | ||
| bool value = 4; /** For sync only - optionally send the pin's value. */ | ||
|
|
||
| /** | ||
| * Direction. Specifies the pin's direction, INPUT or OUTPUT. | ||
| */ | ||
| enum DigitalIODirection { | ||
| DIRECTION_UNSPECIFIED = 0; /** Invalid Direction from Broker. */ | ||
| DIRECTION_INPUT = 1; /** Set the pin to behave as an input. */ | ||
| DIRECTION_INPUT_PULL_UP = 2; /** Set the pin to behave as an input. */ | ||
| DIRECTION_OUTPUT = 3; /** Set the pin to behave as an output. */ | ||
| } | ||
| } | ||
|
|
||
| message DigitalIORemove { | ||
| int32 gpio_num = 1; // correlates with `name` in the JSON | ||
| } | ||
|
|
||
| message DigitalIOEvent { | ||
| int32 gpio_num = 1; | ||
| bool value = 2; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // SPDX-FileCopyrightText: 2023 Brent Rubell, Loren Norman, Tyeth Gundry for Adafruit Industries | ||
| // SPDX-License-Identifier: MIT | ||
| syntax = "proto3"; | ||
|
|
||
| package wippersnapper.error.v1; | ||
| import "nanopb/nanopb.proto"; | ||
|
|
||
| // TODO: Add error handling on the device-side to parse error | ||
| // message and either delay on throttle, or disconnect + exponential retry+jitter | ||
| // on ban time | ||
|
|
||
| // Jitter should be unique to each device, possibly derived from its clientID | ||
|
|
||
| message Error { | ||
| option (nanopb_msgopt).submsg_callback = true; // TODO: Do we need this option field? | ||
| oneof payload { | ||
| int32 ban_time = 1; | ||
| int32 throttle_time = 2; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.