Public Member Functions | |
Sensor (stdClass $data, Api $api) | |
getID () | |
getOwner () | |
getName () | |
getDeviceType () | |
update ($name, $displayName, $deviceType, $pagerType, $dataType, $dataStructure) | |
delete () | |
getData ($page, $perPage, $startDate, $endDate, $date, $next, $last, $sort, $total, $interval=0) | |
updateData ($value, $date) | |
deleteData ($dataID) | |
uploadDataAsJson ($json) | |
getDevice () | |
getMyDevice () | |
getEnvironment () | |
addSharredUser ($userID, $userID) | |
removeSharredUser ($userID) | |
connectSensor ($connectedSensorID) | |
removeConnectedSensor ($connectedSensor) | |
disconnectFromService ($serviceID) | |
getMetatags () | |
listTags ($namespace=NULL) | |
replaceTags ($metatags, $namespace=NULL) | |
updateTags ($metatags, $namespace=NULL) | |
deleteTags ($namespace=NULL) |
Sensor::addSharredUser | ( | $ | userID, |
$ | userID | ||
) |
This method will add a user to a sensor, giving the user access to the sensor and data. Only the owner of the sensor is able to upload data, mutate sensors and add users to their sensor. To add a user at least a username or user_id must be specified.
public
int | userID |
string | username |
Sensor::connectSensor | ( | $ | connectedSensorID | ) |
This method connects a sensor to the sensor selected with <sensor_id>. The type of the selected sensor will be automatically set to 2 (virtual sensor).
public
int | connectedSensorID |
Sensor::delete | ( | ) |
This method will delete a sensor. If the current user is the owner of the sensor then the sensor will be removed from the current user and all other users. If the current user is not owner of the sensor then access to the sensor will be removed for this user.
public
Sensor::deleteData | ( | $ | dataID | ) |
This method deletes a data point
public
int | dataID |
Sensor::deleteTags | ( | $ | namespace = NULL | ) |
Delete sensor tags
This method will delete all the metatags for the given sensor in the given namespace
public
array | metatags an array with the metatags |
string | namespace (optional) Attach metatags to the given namespace. If not given “default” is assumed as the namespace. |
Sensor::disconnectFromService | ( | $ | serviceID | ) |
This method disconnects the parent sensor from the service. The service will be stopped if it's not used by other sensors.
public
int | serviceID |
Sensor::getData | ( | $ | page, |
$ | perPage, | ||
$ | startDate, | ||
$ | endDate, | ||
$ | date, | ||
$ | next, | ||
$ | last, | ||
$ | sort, | ||
$ | total, | ||
$ | interval = 0 |
||
) |
This method will return a list of sensor data. The maximum amount of data points that can be retrieved at once are 1000 items.
public
int | page |
int | perPage |
Date | startDate |
Date | endDate |
Date | date |
int | next |
Boolean | last |
string | sort |
Boolean | total |
The method returns the details of the environment of this sensor.
public
Sensor::getID | ( | ) |
Return metatags
public
This method returns the details of the device to witch the sensor is connected.
public
Sensor::getName | ( | ) |
Sensor::getOwner | ( | ) |
Sensor::listTags | ( | $ | namespace = NULL | ) |
List sensor tags
This method will return a list of metatags attached to the given sensor.
public
Sensor::removeConnectedSensor | ( | $ | connectedSensor | ) |
This method removes a sensor from the parent sensor. If the parent sensor does not have any sensors that it uses, its type will automatically be set to 0. If this parent sensor is also a service, then the connected sensor will also be disconnected from the service.
public
int | connectedSensor |
Sensor::removeSharredUser | ( | $ | userID | ) |
This method removes a users from a sensor, which removes the access to the sensor for this user.
public
int | userID |
Sensor::replaceTags | ( | $ | metatags, |
$ | namespace = NULL |
||
) |
Replacing sensor tags
This method will persist a list of metatags to the given sensor. All metatags that are not mentioned in the uploaded list are removed from the sensor. Metatag names can have a maximum length of 32 (ASCII) characters. The metatag value can have a maximum length of 100 (UTF-8) characters. For now we impose a limit on the amount of metatags attached to a sensor in a single namespace. Currently this is set on 30.
public
array | metatags an array with the metatags |
string | namespace (optional) Attach metatags to the given namespace. If not given “default” is assumed as the namespace. |
Sensor::Sensor | ( | stdClass $ | data, |
Api $ | api | ||
) |
Sensor::update | ( | $ | name, |
$ | displayName, | ||
$ | deviceType, | ||
$ | pagerType, | ||
$ | dataType, | ||
$ | dataStructure | ||
) |
This method will update an existing sensor.
public
string | name |
string | displayName |
string | deviceType |
string | pagerType |
string | dataType |
string | dataStructure |
Sensor::updateData | ( | $ | value, |
$ | date | ||
) |
With this method sensor data can be uploaded. The uploaded data can either be a single value or an array.
public
string | value |
Date | date |
Sensor::updateTags | ( | $ | metatags, |
$ | namespace = NULL |
||
) |
Modifying sensor tags
This method will persist a list of metatags. Existing metatags not mentioned in the uploaded list will be kept. Metatag names can have a maximum length of 32 (ASCII) characters. The metatag value can have a maximum length of 100 (UTF-8) characters. For now we impose a limit on the amount of metatags attached to a sensor in a single namespace. Currently this is set on 30. For now we impose a limit on the amount of metatags attached to a sensor in a single namespace. Currently this is set on 30.
public
array | metatags an array with the metatags |
string | namespace (optional) Attach metatags to the given namespace. If not given “default” is assumed as the namespace. |
Sensor::uploadDataAsJson | ( | $ | json | ) |
With this method sensor data can be uploaded at once for different sensors. The uploaded data can either be a single value or an array.
public
string | json |