Skip to content

Commit b4c77dc

Browse files
committed
Update README.md
1 parent dab4090 commit b4c77dc

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

README.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ microgear-esp8266-arduino is a client library that is used to connect an ESP826
44

55
## Compatibility
66
We have tested this library and found it compatible with (but not limited to) the following hardware
7-
- ESP8266-01
8-
- ESP8266-12E
9-
- NodeMCU v1 ??? v2
7+
- ESP8266-01, 07, 12E, 12F
8+
- NodeMCU v1, v2, V3
109

1110
## Installation
1211
* Download Arduino IDE 1.6.5 from https://www.arduino.cc/en/Main/Software
@@ -32,10 +31,10 @@ Usage Example
3231
const char* ssid = <WIFI_SSID>;
3332
const char* password = <WIFI_KEY>;
3433

35-
#define APPID <APPID>
36-
#define GEARKEY <APPKEY>
37-
#define GEARSECRET <APPSECRET>
38-
#define SCOPE ""
34+
#define APPID <APPID>
35+
#define KEY <APPKEY>
36+
#define SECRET <APPSECRET>
37+
#define ALIAS "mygear"
3938

4039
WiFiClient client;
4140
AuthClient *authclient;
@@ -65,10 +64,9 @@ void onLostgear(char *attribute, uint8_t* msg, unsigned int msglen) {
6564

6665
void onConnected(char *attribute, uint8_t* msg, unsigned int msglen) {
6766
Serial.println("Connected to NETPIE...");
68-
microgear.setName("mygear");
67+
microgear.setAlias("mygear");
6968
}
7069

71-
7270
void setup() {
7371
/* Event listener */
7472
microgear.on(MESSAGE,onMsghandler);
@@ -92,7 +90,7 @@ void setup() {
9290

9391
//uncomment the line below if you want to reset token -->
9492
//microgear.resetToken();
95-
microgear.init(GEARKEY,GEARSECRET,SCOPE);
93+
microgear.init(KEY, SECRET, ALIAS);
9694
microgear.connect(APPID);
9795
}
9896
}
@@ -118,6 +116,7 @@ void loop() {
118116
}
119117
delay(100);
120118
}
119+
121120
```
122121
## Library Usage
123122
---
@@ -126,17 +125,10 @@ void loop() {
126125
**arguments**
127126
* *gearkey* `string` - is used as a microgear identity.
128127
* *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]:&lt;/topic/path&gt; - r and w is the right to publish and subscribe topic as specified such as rw:/outdoor/temp
134-
* name:&lt;gearname&gt; - is the right to name the &lt;gearname&gt;
135-
* chat:&lt;gearname&gt; - is the right to chat with &lt;gearname&gt;
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.
128+
* *alias* `string` - specifies the device alias.
137129
138130
```c++
139131
microGear.init("sXfqDcXHzbFXiLk",
140132
"DNonzg2ivwS8ceksykGntrfQjxbL98",
141-
"r:/outdoor/temp,w:/outdoor/valve,name:logger,chat:plant");
142-
```
133+
"myplant");
134+
```

0 commit comments

Comments
 (0)