How to set push data policy in push asset


#1

Hi

2 questions

In the great samplehelloairvantage example the code references a push data policy.

From the code samples it seems you can set this to ‘hourly’ or ‘now’

’ helloasset:pushdata(“uplink”, { String=str, timestamp=os.time() }, ‘hourly’)

helloasset:pushdata(“uplink”, {FloatingPoint=num, MessageCount=count}, ‘now’)’

are there any other values available?

How can i set this myself? I assume by accessing a value in the devicetree, what is the path for this value and is there a list somewhere which contains other devicetree parameters i can access?

thanks in advance


#2

Hi Matt,

You may want to look at the Tech Article ALEOS AF AirVantage Application Services , or more quickly, see extract below:

Sending Policies Control When Data is Sent to the Server
Send policies determine when data will be sent to the server. Usually, there is a set of send policies that are included in the default configuration. These are:

default” is manual which is only sent when requested using triggerPolicy
ondemand” is also manual
never” is also manual
now” is usually within 5 seconds
hourly” will connect at least once per hour
daily” will connect at least once per day
Sending can be forced at any time with the triggerPolicy function. It has the form:

myAsset.triggerPolicy(policy)

Will force sending of the data attached to the specified policy
If policy is “*”, then all policies are flushed.


#3

You can add or change policies. They are indeed located in the config tree. The path is ‘config.data.policy.NameOfYourPolicy’

By default they are set to
config.data.policy.default = { ‘manual’ }
config.data.policy.hourly = { latency = 6060 }
config.data.policy.daily = { latency = 24
60*60 }
config.data.policy.ondemand = { ‘manual’ }
config.data.policy.never = { ‘manual’ }
config.data.policy.now = { latency = 5, onboot=30 }


#4

So, in summary, if in Matt’s use case the information have to go every 15 min, he should change the ‘default’ policy to:

config.data.policy.default = { latency = 15*60  }

Right?


#5

Correct