C# Class Particle.ParticleDevice

Represents a Device like the Core, Photon or Electron
Inheritance: ParticleBase
Datei anzeigen Open project: ParticleNET/ParticleSDK Class Usage Examples

Public Methods

Method Description
CallFunctionAsync ( String functionName, String arg ) : Task>

Calls the function asynchronous.

FlashExampleAppAsync ( String exampleId ) : Task

Flashes the example application asynchronous.

FlashKnownAppAsync ( String appName ) : Task

Flashes a known application to a device.

GetVariableValueAsync ( String variable ) : Task>

Gets the variable value asynchronous for the provided variable name.

GetVariableValueAsync ( Particle.Variable variable ) : Task>

Gets the variable value asynchronous for the provided variable.

RefreshAsync ( ) : Task

Refreshes the device from the cloud.

RenameAsync ( String newName ) : Task

Renames the Device.

UnclaimAsync ( ) : Task

Unclaims the Device asynchronous.

Protected Methods

Method Description
ParseFunctions ( Newtonsoft.Json.Linq.JArray arr ) : void

Parses the functions.

ParseObject ( Newtonsoft.Json.Linq.JObject obj ) : void

Parses the provided JObject into a ParticleDevice

ParseVariables ( Newtonsoft.Json.Linq.JObject obj ) : void

Parses the variables.

ParticleDevice ( ParticleCloud cloud, Newtonsoft.Json.Linq.JObject obj ) : Newtonsoft.Json

Initializes a new instance of the ParticleDevice class.

Private Methods

Method Description
getVariableType ( JToken type ) : VariableType

Gets the type of the variable. if the type does not match a known type returns VariableType.String

parseBooleanValue ( JToken token ) : bool
parseDateTimeValue ( JToken token ) : DateTime?
parseIntValue ( JToken token ) : int
parseNullableIntValue ( JToken token ) : int?
parseStringValue ( JToken token ) : String

Method Details

CallFunctionAsync() public method

Calls the function asynchronous.
public CallFunctionAsync ( String functionName, String arg ) : Task>
functionName String Name of the function.
arg String The argument.
return Task>

FlashExampleAppAsync() public method

Flashes the example application asynchronous.
a null example id is passed
public FlashExampleAppAsync ( String exampleId ) : Task
exampleId String The example identifier. This can be found at build.particle.io
return Task

FlashKnownAppAsync() public method

Flashes a known application to a device.
public FlashKnownAppAsync ( String appName ) : Task
appName String Name of the application.
return Task

GetVariableValueAsync() public method

Gets the variable value asynchronous for the provided variable name.
public GetVariableValueAsync ( String variable ) : Task>
variable String The variable.
return Task>

GetVariableValueAsync() public method

Gets the variable value asynchronous for the provided variable.
public GetVariableValueAsync ( Particle.Variable variable ) : Task>
variable Particle.Variable The variable.
return Task>

ParseFunctions() protected method

Parses the functions.
protected ParseFunctions ( Newtonsoft.Json.Linq.JArray arr ) : void
arr Newtonsoft.Json.Linq.JArray The arr.
return void

ParseObject() protected method

Parses the provided JObject into a ParticleDevice
is null There was an error parsing the json provided. (This should be added as an issue when it happens)
protected ParseObject ( Newtonsoft.Json.Linq.JObject obj ) : void
obj Newtonsoft.Json.Linq.JObject The object.
return void

ParseVariables() protected method

Parses the variables.
protected ParseVariables ( Newtonsoft.Json.Linq.JObject obj ) : void
obj Newtonsoft.Json.Linq.JObject The object.
return void

ParticleDevice() protected method

Initializes a new instance of the ParticleDevice class.
protected ParticleDevice ( ParticleCloud cloud, Newtonsoft.Json.Linq.JObject obj ) : Newtonsoft.Json
cloud ParticleCloud The cloud.
obj Newtonsoft.Json.Linq.JObject The JSon object to parse
return Newtonsoft.Json

RefreshAsync() public method

Refreshes the device from the cloud.
public RefreshAsync ( ) : Task
return Task

RenameAsync() public method

Renames the Device.
public RenameAsync ( String newName ) : Task
newName String The new name.
return Task

UnclaimAsync() public method

Unclaims the Device asynchronous.
public UnclaimAsync ( ) : Task
return Task