You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void onConnected(char *attribute, uint8_t* msg, unsigned int msglen) {
67
66
Serial.println("Connected to NETPIE...");
68
-
microgear.setName("mygear");
67
+
microgear.setAlias("mygear");
69
68
}
70
69
71
-
72
70
void setup() {
73
71
/* Event listener */
74
72
microgear.on(MESSAGE,onMsghandler);
@@ -92,7 +90,7 @@ void setup() {
92
90
93
91
//uncomment the line below if you want to reset token -->
94
92
//microgear.resetToken();
95
-
microgear.init(GEARKEY,GEARSECRET,SCOPE);
93
+
microgear.init(KEY, SECRET, ALIAS);
96
94
microgear.connect(APPID);
97
95
}
98
96
}
@@ -118,6 +116,7 @@ void loop() {
118
116
}
119
117
delay(100);
120
118
}
119
+
121
120
```
122
121
## Library Usage
123
122
---
@@ -126,17 +125,10 @@ void loop() {
126
125
**arguments**
127
126
* *gearkey* `string` - is used as a microgear identity.
128
127
* *gearsecret* `string` comes in a pair with gearkey. The secret is used for authentication and integrity.
129
-
* *scope* `string` - specifies the right.
130
-
131
-
**scope** is an optional field. This can be specified when the microgear needs additional rights beyond default scope. If the scope is specified, it may need an approval from the Application ID's owner for each request. The scope format is the concatenation of strings in the following forms, separated with commas:
132
-
133
-
* [r][w]:</topic/path> - r and w is the right to publish and subscribe topic as specified such as rw:/outdoor/temp
134
-
* name:<gearname> - is the right to name the <gearname>
135
-
* chat:<gearname> - is the right to chat with <gearname>
136
-
In the key generation process on the web netpie.io, the developer can specify basic rights to each key. If the creation of microgear is within right scope, a token will be automatically issued, and the microgear can be connected to NETPIE immediately. However, if the requested scope is beyond the specified right, the developer will recieve a notification to approve a microgear's connection. Note that if the microgear has operations beyond its right (e.g., pulishing to the topic that it does not has the right to do so), NETPIE will automatically disconnect the microgear. In case that APPKEY is used as a gearkey, the developer can ignore this attribute since by default the APPKEY will gain all rights as the ownwer of the app.
0 commit comments