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
Hop on over to [the Particle.io store](https://store.particle.io) and order any of their cool devices.
21
19
22
-
While developing this plugin and the [demo app](demo/) I used a [Photon Kit](https://store.particle.io/collections/photon) and it was a joy to work with (thanks, [Brandon Satrom](https://twitter.com/BrandonSatrom) for sending one over!).
20
+
> While developing this plugin and the [demo app](demo/) I used a [Photon Kit](https://store.particle.io/collections/photon) and it was a joy to work with (thanks, [Brandon Satrom](https://twitter.com/BrandonSatrom) for sending one over)!
23
21
24
22
## Installation
25
23
```bash
@@ -34,10 +32,10 @@ follow these steps to install the demo app I've created with NativeScript Core:
> Tip: If you get fed up by entering your login credentials every time, set the `PARTICLE_USERNAME` and `PARTICLE_PASSWORD` properties to reflect your own, at `demo/app/main-view-modal.ts`.
38
+
> Tip: If you get tired entering your login credentials every time you log in, set the [`PARTICLE_USERNAME` and `PARTICLE_PASSWORD` properties to reflect your own](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/demo/app/main-view-model.ts#L7-L8).
41
39
42
40
## API
43
41
All examples below assume you have these imports and instantiated the `Particle` class:
@@ -48,7 +46,8 @@ const particle = new Particle();
48
46
```
49
47
50
48
### `login`
51
-
Communication between your app and a device is HTTP (REST) based, so the first step is authenticating yourself with the Particle Cloud.
49
+
Communication between your app and a device is HTTP (REST) based,
50
+
so the first step is authenticating yourself with the Particle Cloud:
52
51
53
52
```typescript
54
53
particle.login(
@@ -91,14 +90,15 @@ The returned list of `TNSParticleDevice` objects has these properties and functi
91
90
| id |`string`| The unique ID of this device. |
92
91
| name |`string`| The given name of this device. |
93
92
| status |`string`| The current status of the device, usually `normal`. |
94
-
| type |`TNSParticleDeviceType`| One of `Unknown`, `Core`, `Photon`, `P1`, `Electron`, `RaspberryPi`, `DigistumpOak`, `RedBearDuo`, `Bluz`. |
93
+
| type |`[TNSParticleDeviceType](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/src/particle.common.ts#L1-L10)`| One of `Unknown`, `Core`, `Photon`, `P1`, `Electron`, `RaspberryPi`, `DigistumpOak`, `RedBearDuo`, `Bluz`. |
95
94
| functions |`Array<string>`| The list of functions currently available on the device. You can invoke these with `callFunction` (see below). |
96
-
| variables |`Array<TNSParticleDeviceVariable>`| The list of variables currently available on the device. You can get their values with `getVariable` (see below). |
95
+
| variables | Array<[TNSParticleDeviceVariable](https://github.com/EddyVerbruggen/nativescript-particle/blob/618dea7d0a5d3c1cd9cb287e70142375547faa60/src/particle.common.ts#L38-L41)>| The list of variables currently available on the device. You can get their values with `getVariable` (see below). |
97
96
98
97
#### `<device>.callFunction`
99
98
You can invoke any of the `functions` you discovered on the device.
100
99
101
-
As an example let's assume you've flashed [this code tutorial](https://docs.particle.io/guide/getting-started/examples/photon/#read-your-photoresistor-function-and-variable) to your device, so there's a `led` function which takes 1 argument: `"on"`, or `"off"`:
100
+
As an example let's assume you've flashed [this code tutorial](https://docs.particle.io/guide/getting-started/examples/photon/#read-your-photoresistor-function-and-variable) to your device,
101
+
so there's a `led` function which takes 1 argument: the value must be either `"on"`, or `"off"`:
102
102
103
103
```typescript
104
104
const myDevice:TNSParticleDevice=null; // you got this from 'listDevices'
0 commit comments