Core Carriots libraries (com.carriots.sdk)

Device class

Device management can be done with com.carriots.sdk.Device class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String
type String
description String
sensor String See sensor list in REST API
checksum String
time_zone String "Europe/Madrid"
frequency_status Integer 1440 Minutes
frequency_stream Integer 1440 Minutes
enabled Boolean true
id_group String Valid group developer ID. Example: “parking@carriots”
id_model String Valid model developer ID. Example: “g2model@carriots”
id_asset String Valid model developer ID. Example: “asset1@carriots”
networking Networking Networking object . See Networking class for more details
device_properties java.util.Map key-value map
lat Float Example: 40.999988765
lon Float Example: -3.6566665324

Public methods:

create()

Creates a device. Returns the response JSON message from the SDK engine as java.util.Map

update()

updates a device. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Device object.

findby(criteriaMap)

Static method that receives a Map with search criteria and returns a java.util.List of hydrated Device objects or an empty List. Refer to REST API documentation for details about criteria. Refer to REST API documentation for details about criteria.

delete()

Delete the device. Returns the response JSON message from the SDK engine as java.util.Map

inside(Float geo_lon, Float geo_lat, Float geo_distance, String geo_id_developer)

There are two flavors for inside method: Static and dynamic.
This methods receives the follow params: geo_lat (latitude), geo_lon (longitude), geo_distance(distance in meters) and in the static flavor geo_id_developer.
Return boolean result from searches on concentrically growing donuts (circular polygons with with circular holes).

 

Asset class

Asset management can be done with com.carriots.sdk.Asset class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
type String ""
description String ""
enabled Boolean true
id_group String "" Valid group developer ID. Example: “parking@carriots”
asset_properties java.util.Map null key-value map

Public methods:

create()

Creates an asset. Returns the response JSON message from the SDK engine as java.util.Map

update()

Updates an asset. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Asset object

findby(criteriaMap)

static method that receives a Map with search criteria and returns a java.util.List of hydrated Asset objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the asset. Returns the response JSON message from the SDK engine as java.util.Map

 

Group class

Group management can be done with com.carriots.sdk.Group class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
enabled Boolean true
id_service String "" Valid service developer ID. Example: “parkingcontrol@carriots”

Public methods:

create()

Creates a group. Returns the response JSON message from the SDK engine as java.util.Map.

update()

Updates a group. Returns the response JSON message from the SDK engine as java.util.Map.

find(id_developer)

Static method that receives an id_developer and returns an hydrated Group object.

findby(criteriaMap)

Static method that receives a Map with search criteria and returns a java.util.List of hydrated Group objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the group. Returns the response JSON message from the SDK engine as java.util.Map

 

Service class

Service management can be done with com.carriots.sdk.Service class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
enabled Boolean true
id_project String "" Valid project developer ID. Example: “smartcity@carriots”

Public methods:

create()

Creates a service. Returns the response JSON message from the SDK engine as java.util.Map.

update()

Updates a service. Returns the response JSON message from the SDK engine as java.util.Map.

find(id_developer)

Static method that receives an id_developer and returns an hydrated Service object.

findby(criteriaMap)

static method that receives a Map with search criteria and returns a java.util.List of hydrated Service objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the service. Returns the response JSON message from the SDK engine as java.util.Map

 

Project class

Project management can be done with com.carriots.sdk.Project class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
enabled Boolean true
id_customer String "" Valid project developer ID. Example: “carriots”

Public methods:

create()

Creates a project. Returns the response JSON message from the SDK engine as java.util.Map

update()

Updates a project. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Project object.

findby(criteriaMap)

Static method that receives a Map with search criteria and returns a java.util.List of hydrated Project objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the project. Returns the response JSON message from the SDK engine as java.util.Map

 

Stream class

Streams can be accessed from Carriots SDK com.carriots.sdk.Stream class. It provides basic searching methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
protocol String ""
device String ""
data java.util.Map null
at Long null Timestamp

Public methods:

find(id_developer)

Static method that receives an id_developer and returns an hydrated Stream object.

findby(criteriaMap)

static method that receives a Map with search criteria and returns a java.util.List of hydrated Stream objects or an empty List. Refer to REST API documentation for details about criteria.

 

Alarm class

Alarm management can be done with com.carriots.sdk.Alarm class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
entity Entity null See Entity class definition.
custom_data String ""
severity Integer
state String "" One of “active”, “acknowledged”, “closed” or “disabled”
type String ""
enabled Boolean true
id_project String "" Valid project developer ID. Example: “smartcity@carriots”

Public methods:

create(create)

Creates a alarm. Returns the response JSON message from the SDK engine as java.util.Map

update()

Updates a alarm. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Alarm object.

findby(criteriaMap)

Static method that receives a Map with search criteria and returns a java.util.List of hydrated Alarm objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the alarm. Returns the response JSON message from the SDK engine as java.util.Map

 

Rule class

Rule management can be done with com.carriots.sdk.Rule class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
enabled Boolean true
script String "" Groovy script

Public methods:

create()

Creates a rule. Returns the response JSON message from the SDK engine as java.util.Map.

Note that multi line strings in groovy must be enclosed by “”” (triple double quotes): http://groovy.codehaus.org/Strings+and+GString

update()

Updates a rule. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Rule object.

findby(criteriaMap)

static method that receives a Map with search criteria and returns a java.util.List of hydrated Rule objects or an empty List. Refer to REST API documentation for details about criteria.

eval()

Evaluates the rule script and returns the evaluation result.

delete()

Deletes the rule. Returns the response JSON message from the SDK engine as java.util.Map

 

Listener class

Listener management can be done with com.carriots.sdk.Listener class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
event String "" One of available events (see REST API)
entity Entity null See Entity
if_expression String "" Expression to be evaluated
then_expression String "" Expression to be evaluated when if_expression evaluates to true
then_rule String "" Valid id_developer of the rule to be executed when if_expression evaluates to true
else_expression String "" Expression to be evaluated when if_expression evaluates to false
else_rule String "" Valid id_developer of the rule to be executed when if_expression evaluates to false
enabled Boolean true

Public methods:

create()

Creates a listener. Returns the response JSON message from the SDK engine as java.util.Map.

Note that multi line strings in groovy must be enclosed by “”” (triple double quotes): http://groovy.codehaus.org/Strings+and+GString

update()

Updates a listener. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Listener object.

findby(criteriaMap)

Static method that receives a Map with search criteria and returns a java.util.List of hydrated Listener objects or an empty List. Refer to REST API documentation for details about criteria.

eval()

Evaluates the rule script and returns the evaluation result.

delete()

Deletes the listener. Returns the response JSON message from the SDK engine as java.util.Map

 

Trigger class

Listener management can be done with com.carriots.sdk.Trigger class. It provides basic CRUD (Create, Read, Update and Delete) methods.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
name String ""
description String ""
max_retries Integer 10 Push max retries
push_frequency Integer 0 Minutes
external_configuration ConfigTrigger null Embedded external configuration object
id_service String "" Valid service id_developer
enabled Boolean true

Public methods:

create()

Creates a trigger. Returns the response JSON message from the SDK engine as java.util.Map.

Note that multi line strings in groovy must be enclosed by “”” (triple double quotes): http://groovy.codehaus.org/Strings+and+GString

update()

Updates a triggers. Returns the response JSON message from the SDK engine as java.util.Map

find(id_developer)

Static method that receives an id_developer and returns an hydrated Trigger object.

findby(criteriaMap)

static method that receives a Map with search criteria and returns a java.util.List of hydrated Trigger objects or an empty List. Refer to REST API documentation for details about criteria.

delete()

Deletes the trigger. Returns the response JSON message from the SDK engine as java.util.Map

 

ConfigTrigger class

ConfigTrigger class goal is to define a trigger external configuration. It’s a convenience class to be embedded in a Trigger class.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
url String ""
verb String ""
headers java.util.Map null Key-value map
params java.util.Map null Key-value map
payload String "" Embedded external configuration object
http_auth java.util.Map null Key-value map

Use example:

 

Networking class

Networking class goal is to define a device’s networking properties. It’s a convenience class to be embedded in a Device class.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
type String ""
conn_address String ""
sim_card String ""
carrier String ""

Use example:

 

Entity class

Entity class goal is to define a device’s networking properties. It’s a convenience class to be embedded in an Alarm class.

Public properties (refer to REST API properties for more details):

Property name Type Default value Comment
entity_type String ""
id String ""

Use example: