Roles define the services offered by a particular type of device. For example, the role for a video camera with pan and tilt capabilities would include definitions for "up", "down", "left", and "right" while a binary sensor might just have "on" and "off". Roles are not specific to a particular device or app. Instead each role represents a set of capabilities which may be shared by many devices and apps.  When writing or extending device drivers and apps, you can use the predefined roles or create a custom role class if necessary. A more specific role can inherit the capabilities from a more basic (generic) role. For example, a Pan Tilt Camera role is a more specific role that inherits from the Camera role.  

Note that roles do not need to be baked into the platform. You can add a custom role class anywhere, as long as that class can be referenced by the driver and application modules that use it. They are purely an agreement between the app and driver. Inside the platform, message passing only understands lists of ParamTypes. What goes into the list is determined by the roles class. In the source code, some example roles are defined in Hub\Common\Common\role.cs. The RoleDummy class was created to demonstrate the preferred pattern for creating a role. 

Below is a list of existing roles with the hierarchy and operations for each: 

Inherits from

Role Name

Description

Operations

Role

RoleDummy : Role

A dummy example role

Echo; Echosub (subscribe to echo's)

 

RoleSensor : Role

Basic sensor role

Get

 

RoleProximitySensor : Role

Proximity sensor

Get

 

RoleActuator : Role

Actuate something

Put

 

RoleSensorMultiLevel : Role

Multi-level sensor

Get

 

RoleSwitchBinary : Role

A switch

Get, Set

 

RoleLightColor : Role

Color of the light

Get, Set

 

RoleMicrophone : Role

A microphone

RecAudio

 

RoleSkeletonTracker : Role

Provide skeleton tracker from Kinect v1

Lastskeleton, rcvskeletonstream

 

RoleSpeechReco : Role

Provides speech recognition (this is very naïve and has hardcoded simple grammar right now, uses Windows Speech SDK)

Speechphrase

speechrecosub

 

RoleHueBridge : Role

Bridge to Hue lights

Toggleall, turnoffall, turnonall, resetall, unlockall, setcolorall, setbrightnessall, togglebulb, turnoffbulb, turnonbulb, resetbulb, unlockbulb, setcolorbulb, getcolorbulb, setbrightnessbulb, bumpbulb

 

RoleDepthCam : Role

Depth Camera

Lastdepthimg, rcvdepthstream, lastdeptharray, rcvdeptharray

 

RoleCamera : Role

Basic Camera

Getimage, getvideo

RoleCamera

 

 

 

 

RolePTCamera : RoleCamera

Pan Tilt camera

Getimage, getvideo, Up, down, left, right

RolePTCamera

 

 

 

 

RolePTZCamera : RolePTCamera

Pan Tilt zoom camera

Getimage, getvideo, Up, down, left, right

Zoomin, zoomout

 

 

 

 

RoleSensorMultiLevel

 

 

 

 

RolePowerSensor : RoleSensorMultiLevel

Power MultiLevel Sensor

Get

 

RoleTemperatureSensor : RoleSensorMultiLevel

Temperature sensor

Get

 

RoleHumiditySensor : RoleSensorMultiLevel

Humidity

Get

 

RoleLuminositySensor : RoleSensorMultiLevel

Light level

Get

 

RoleBatteryLevel : RoleSensorMultiLevel

Battery Level

Get

 

  

RolePowerSensor : RoleSensorMultiLevel

  

Power sensor

 Get

Last edited May 10, 2014 at 2:35 AM by dannyh206, version 2

Comments

No comments yet.