Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mihini-dev] Mihini Table Related Variables

Hi,

 

1) In Lua everything evaluates to true but ‘false’ and ‘nil’.

If you want to explicitly specify purge, then use false, i.e.

      local tab1 = asset:newTable("bedroom", {"temperature", "pressure", "timestamp"}, "file", "now", false)

 

When purge is set to true, the local data are erased once successfully flushed to the server.

Please see documentation / code for more details

 

2) the airvantage.acknowledge is advanced usage. You should not need it unless you are actually implementing a function to handled message from server.

If that is the case, please look in the “asset.tree” documentation. You have to register a function there. That function is going to be called when the server send a message to the device (it had to be on the same variable as the function name…).

One of the input param of an incoming message is going to be a ticketid/ackid. You can then use that ackid to actually acknowledge the incoming message.

 

Again I am not sure that is what you want to do. Please look at the code to understand the workflow.

 

Regards,

Cuero

 

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of satishbaganal iit
Sent: Monday, November 24, 2014 2:37 PM
To: mihini-dev@xxxxxxxxxxx
Subject: [mihini-dev] Mihini Table Related Variables

 

Hi

1.I have created table as per the following
     
      local tab1 = asset:newTable("bedroom", {"temperature", "pressure", "timestamp"}, "file", "now",0)
     
  and i mentioned  purge = 0 and i am getting the following output in syslog.
     
      EMP-DEBUG: [->RCV] [CMD] #1 TableNew {"path":"bedroom","storage":"file","purge":true,"policy":"now","asset":"house","columns":["temperature","pressure","timestamp"]}

 Please guide me what is the purge variable and how to use it.

     
2. I am using the following line in my code as acknowledge

assert(airvantage.acknowledge(0, 0, "BANG BANG BANG", "now", 0))

Syslog Output:

EMP-DEBUG: [->RCV] [CMD] #1 PAcknowledge {"message":"BANG BANG BANG","ticket":0,"status":0,"policy":"now","persisted":0}
EMP-DEBUG: payload = table: 0x882f3a8, type = table, serialized = {"message":"BANG BANG BANG","ticket":0,"status":0,"policy":"now","persisted":0}

      I am not getting how to verify the acknowledge result and what response i am
 getting how to use acknowledge please guide me.     


Back to the top