TTP Subscriptions

Subscribing

Subscriptions enable the updating of metering and level values to be sent to a external control system without the control system requesting information.

Elements of a processing object can be subscribed to such as channel levels and meters. The Attribute tables will indicate which functions support subscription.

If subscriptions are used the Tesira server may be sending back replies that were not individually requested from the control system (they were subscribed to).  All subscribed objects will be preceded by a ! “publishToken” statement would indicate to the control system that the returned packet is from a subscription not a response to a command that was just sent.

Subscriptions are lost when the Tesira server is rebooted or a change in configuration is sent to the system. Subscriptions can be revalidated by subscribing to the same block at regular intervals.  If this is done ensure that the custom label used in Index is used in the re-subscription. If this label is not included it is possible to inadvertently open multiple subscriptions to the same call state.

Instance Tag Command Attribute [Index] [Index] [Value] LF

 

To Subscribe to a level with a 500ms refresh

Instance Tag

Command

Attribute Code

Index

Index

Value

MyLevel1

subscribe

level

 1

MyLevelName

500

Verbose Subscription Responses

When the subscription command is first sent the first reply will be:

! "publishToken":"[CustomName]" "value":[Value] +OK

Subsequent subscription replies will be formatted

! "publishToken":"[CustomName]" "value":[Value]

Verbose Example

MyLevel1 subscribe level 1 MyLevelName 500   ! "publishToken":"MyLevelName" "value":-100.000000 +OK ! "publishToken":"MyLevelName" "value":-98.099998 ! "publishToken":"MyLevelName" "value":-77.800003 ! "publishToken":"MyLevelName" "value":-35.299999

 

Verbose Example

MyLevel1 subscribe level 1   ! "publishToken":"" "value":-100.000000 +OK ! "publishToken":"" "value":-98.099998 ! "publishToken":"" "value":-77.800003 ! "publishToken":"" "value":-35.299999

 

Non-Verbose Subscription Responses

If a non-verbose response is required this must be specified before as a SESSION command and must be configured before the subscription.

 

When the subscription command is first sent the first reply will be:

! "[CustomName]" [Value] +OK

 

Subsequent subscription replies will be formatted

! "[CustomName]" [Value]

Verbose Example
Welcome to the Tesira Text Protocol Server...   SESSION set verbose false +OK   MyLevel1 subscribe level 1 myLevelName 500 ! "myLevelName" -40.244328 +OK ! "myLevelName" -38.992748 ! "myLevelName" -41.044147 ! "myLevelName" -40.063908 ! "myLevelName" -38.674465

 

Unsubscribing

Once a value has been subscribed to, the unsubscribe command is used to cancel the request. If an Index and value have been specified in the original subscribe request they must be used in the unsubscribe request.

 

Instance_Tag Command Attribute [Index] [Value] LF

To unsubscribe to a level.

Instance Tag

Command

Attribute Code

Index

Index

MyLevel1

unsubscribe

level

 1

MyLevelName

 

Example

MyLevel1 subscribe level 1 MyLevelName 500   ! "publishToken":"MyLevelName" "value":-100.000000 +OK ! "publishToken":"MyLevelName" "value":-98.099998 ! "publishToken":"MyLevelName" "value":-77.800003 ! "publishToken":"MyLevelName" "value":-35.299999   MyLevel1 unsubscribe level 1 MyLevelName +OK