com.eurotech.demo.tbm
Class TbmDemo

java.lang.Object
  extended by com.eurotech.demo.tbm.TbmDemo
All Implemented Interfaces:
CloudClientListener, ConfigurableComponent

public class TbmDemo
extends Object
implements CloudClientListener, ConfigurableComponent


Constructor Summary
TbmDemo()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext)
           
 void configureDIOConnection()
           
protected  void deactivate(org.osgi.service.component.ComponentContext componentContext)
           
 Properties getSerialDIOProperties()
           
 boolean isDIO_Changed()
           
 void onConnectionEstablished()
          Called when the CloudClient has successfully connected with the broker.
 void onConnectionLost()
          Called when the client has lost its connection with the broker.
 void onControlMessageArrived(String deviceId, String appTopic, EsfPayload msg, int qos, boolean retain)
          Called by the CloudClient when it receives a published control message from the broker.
 void onMessageArrived(String deviceId, String appTopic, EsfPayload msg, int qos, boolean retain)
          Called by the client when it receives a published data message from the broker.
 void onMessageConfirmed(int messageId, String appTopic)
          Called by the CloudClient when a published message has been fully acknowledged by the broker, as appropriate for the quality of service.
 void onMessagePublished(int messageId, String appTopic)
          Called by the CloudClient when a message has been transfered from the publishing queue to the underlying DataTransportService for publishing on the wire.
 void setCloudService(CloudService cloudService)
           
 void setConnectionFactory(org.osgi.service.io.ConnectionFactory connectionFactory)
           
 void setDIO_Changed(boolean dIO_Changed)
           
 void unsetCloudService(CloudService cloudService)
           
 void unsetConnectionFactory(org.osgi.service.io.ConnectionFactory connectionFactory)
           
 void updated(Map<String,Object> properties)
           
 void updateMetrics(int dio_lsb, int dio_msb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TbmDemo

public TbmDemo()
Method Detail

getSerialDIOProperties

public Properties getSerialDIOProperties()

setCloudService

public void setCloudService(CloudService cloudService)

unsetCloudService

public void unsetCloudService(CloudService cloudService)

setConnectionFactory

public void setConnectionFactory(org.osgi.service.io.ConnectionFactory connectionFactory)

unsetConnectionFactory

public void unsetConnectionFactory(org.osgi.service.io.ConnectionFactory connectionFactory)

activate

protected void activate(org.osgi.service.component.ComponentContext componentContext)

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext componentContext)

updated

public void updated(Map<String,Object> properties)

updateMetrics

public void updateMetrics(int dio_lsb,
                          int dio_msb)

configureDIOConnection

public void configureDIOConnection()
                            throws Exception
Throws:
Exception

onConnectionEstablished

public void onConnectionEstablished()
Description copied from interface: CloudClientListener
Called when the CloudClient has successfully connected with the broker.
If the bundle using the client relies on subscriptions beyond the default ones, it is responsibility of the application to implement the CloudClientListener.onConnectionEstablished() callback method to restore the subscriptions it needs after a connection loss.

Specified by:
onConnectionEstablished in interface CloudClientListener

onConnectionLost

public void onConnectionLost()
Description copied from interface: CloudClientListener
Called when the client has lost its connection with the broker. Depending on the DataService configuration, the client will attempt to reconnect and call the CloudClientListener.onConnectionEstablished() method upon a successful reconnect. This is only a notification, the callback handler should not attempt to handle the reconnect.
If the bundle using the client relies on subscriptions beyond the default ones, it is responsibility of the application to implement the CloudClientListener.onConnectionEstablished() callback method to restore the subscriptions it needs after a connection loss.

Specified by:
onConnectionLost in interface CloudClientListener

onControlMessageArrived

public void onControlMessageArrived(String deviceId,
                                    String appTopic,
                                    EsfPayload msg,
                                    int qos,
                                    boolean retain)
Description copied from interface: CloudClientListener
Called by the CloudClient when it receives a published control message from the broker. If the message received has a binary payload that it has NOT been encoded using the the EsfPayload class, the received bytes will be set as the body field of a new EsfPaylaod instance which is passed to the callback Listener interface.

Specified by:
onControlMessageArrived in interface CloudClientListener
Parameters:
deviceId - The deviceId this message was addressed to.
appTopic - The appTopic the message arrived on.
msg - The EsfPayload that arrived.
qos - The Quality of Service that the message was received on.
retain - Whether the message was retained by the broker.

onMessageArrived

public void onMessageArrived(String deviceId,
                             String appTopic,
                             EsfPayload msg,
                             int qos,
                             boolean retain)
Description copied from interface: CloudClientListener
Called by the client when it receives a published data message from the broker. If the message received has a binary payload that it has NOT been encoded using the the EsfPayload class, the received bytes will be set as the body field of a new EsfPaylaod instance which is passed to the callback Listener interface.

Specified by:
onMessageArrived in interface CloudClientListener
Parameters:
deviceId - The asset ID of the semanticTopic prefix the message arrived on.
appTopic - The appTopic the message arrived on.
msg - The EsfPayload that arrived.
qos - The Quality of Service that the message was received on.
retain - Whether the message was retained by the broker.

onMessagePublished

public void onMessagePublished(int messageId,
                               String appTopic)
Description copied from interface: CloudClientListener
Called by the CloudClient when a message has been transfered from the publishing queue to the underlying DataTransportService for publishing on the wire.

Specified by:
onMessagePublished in interface CloudClientListener

onMessageConfirmed

public void onMessageConfirmed(int messageId,
                               String appTopic)
Description copied from interface: CloudClientListener
Called by the CloudClient when a published message has been fully acknowledged by the broker, as appropriate for the quality of service. The published method is not called for QoS 0 publications.

Specified by:
onMessageConfirmed in interface CloudClientListener
Parameters:
messageId - The message id of the published message

isDIO_Changed

public boolean isDIO_Changed()

setDIO_Changed

public void setDIO_Changed(boolean dIO_Changed)


Copyright © 2013. All Rights Reserved.