public class AylaMessageProperty extends AylaProperty<java.lang.String>
AylaProperty.Wrapper<T>
_owningDevice, ackedAt, ackEnabled, ackMessage, ackStatus, BASE_TYPE_BOOLEAN, BASE_TYPE_DECIMAL, BASE_TYPE_FILE, BASE_TYPE_INTEGER, BASE_TYPE_MESSAGE, BASE_TYPE_STRING, baseType, dataUpdatedAt, DEFAULT_ACK_WAIT_TIME, direction, displayName, key, MAX_DATAPOINT_COUNT, metadata, name, readOnly, type, value
Constructor and Description |
---|
AylaMessageProperty() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
createDatapointEndpoint()
Returns the endpoint path required to create/get new datapoionts.
|
protected java.lang.String |
createDatapointPayload(java.lang.String value,
java.util.Map<java.lang.String,java.lang.String> metadata)
Create the payload required to create the datapoiont.
|
AylaAPIRequest |
fetchMessageContent(com.android.volley.Response.Listener<java.lang.String> successListener,
ErrorListener errorListener)
Fetches the message content from the cloud through the stored datapoint ID.
|
java.lang.String |
getMessageContent()
Returns the local message content which was updated from a successful call to
fetchMessageContent(Response.Listener, ErrorListener) , or returns null
if no such message content was ever fetched. |
protected java.lang.String |
getMessageDatapoiontId()
Returns the message datapoint Id.
|
boolean |
isLanModeSupported()
Return true if this property supports LAN mode, which means its datapoints can be created
and retrieved from LAN mode.
|
protected java.lang.String |
parseDatapointIdFromValue(java.lang.String value)
Parses the value passed in and returns the message datapoint Id if found,
otherwise returns null.
|
protected void |
setMessageDatapoiontId(java.lang.String id)
Set the datapoint id of this message property.
|
PropertyChange |
updateFrom(AylaDatapoint<java.lang.String> dp,
AylaDevice.DataSource dataSource)
Updates the property's value from the given datapoint and notifies any listeners of our
owning device of the change.
|
PropertyChange |
updateFrom(AylaProperty otherProperty,
AylaDevice.DataSource dataSource)
Updates the property from another property and notifies any listeners of our owning device
of any changes that resulted.
|
PropertyChange |
updateFrom(java.lang.String value,
java.util.Map<java.lang.String,java.lang.String> metadata,
AylaDevice.DataSource updateSource)
Updates the property's value and notifies any listeners of our owning device of the change.
|
createDatapoint, createDatapoint, createDataPointBlob, createDatapointCloud, createDatapointCloud, createDatapointEndpoint, createDatapointLAN, createDatapointLAN, createTrigger, deleteTrigger, fetchDatapoints, fetchDatapointWithID, fetchTriggers, getAckedAt, getAckMessage, getAckStatus, getBaseType, getDataUpdatedAt, getDeviceManager, getDirection, getDisplayName, getKey, getLastUpdateSource, getMetadata, getName, getOwner, getSessionManager, getType, getValue, isAckEnabled, isReadOnly, setLastUpdateSource, toString, updateTrigger
@Nullable public java.lang.String getMessageContent()
fetchMessageContent(Response.Listener, ErrorListener)
, or returns null
if no such message content was ever fetched.on how to fetch
online message content.
@Nullable protected java.lang.String getMessageDatapoiontId()
protected void setMessageDatapoiontId(java.lang.String id)
public AylaAPIRequest fetchMessageContent(@NonNull com.android.volley.Response.Listener<java.lang.String> successListener, @NonNull ErrorListener errorListener)
Note that the message value return from AylaProperty.getValue()
differs from the real
message content that it only holds an reference to the real message content in the
cloud. Internally, two steps are needed to fetch the real message content.
successListener
- Listener to receive the message content on success.errorListener
- Listener to receive error information should one occurred.@Nullable protected java.lang.String parseDatapointIdFromValue(@Nullable java.lang.String value)
value
- the value that may contains a valid message datapoint Id.protected java.lang.String createDatapointEndpoint()
AylaProperty
createDatapointEndpoint
in class AylaProperty<java.lang.String>
protected java.lang.String createDatapointPayload(java.lang.String value, java.util.Map<java.lang.String,java.lang.String> metadata)
AylaProperty
createDatapointPayload
in class AylaProperty<java.lang.String>
value
- the datapoiont value to be sent to the cloud.metadata
- (optional) metadata associated with the datapoint value.public boolean isLanModeSupported()
AylaProperty
isLanModeSupported
in class AylaProperty<java.lang.String>
public PropertyChange updateFrom(AylaDatapoint<java.lang.String> dp, AylaDevice.DataSource dataSource)
AylaProperty
updateFrom
in class AylaProperty<java.lang.String>
dp
- Datapoint used to update this property's valuepublic PropertyChange updateFrom(AylaProperty otherProperty, AylaDevice.DataSource dataSource)
AylaProperty
This method should only be called internally.
updateFrom
in class AylaProperty<java.lang.String>
otherProperty
- Property to take our new values frompublic PropertyChange updateFrom(java.lang.String value, java.util.Map<java.lang.String,java.lang.String> metadata, AylaDevice.DataSource updateSource)
AylaProperty
This method should only be called internally.
updateFrom
in class AylaProperty<java.lang.String>
value
- New value to setmetadata
- New metadata