Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mihini-dev] Appcon module

Cool that it is now working !

In the future, please embedded more error traces to help me spot the issue.

In the current case you could do a print of the returned values like: print(client:call('agent.appcon.install','main1','/home/ramsath/app','true'))

 

Also FYI calling the function in RPC or a on a Lua Telnet shell should be exactly the same.

 

Cuero

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of Mohammadu Ramsath
Sent: Wednesday, December 18, 2013 12:09 PM
To: Mihini project developer discussions
Subject: Re: [mihini-dev] Appcon module

 

Hi cuero


client, err = rpc.newclient('localhost', 1999)
client:call('agent.appcon.

install','main1','/home/ramsath/app','true')
end

also works, now

Thanks for your great help

 

 

On Wed, Dec 18, 2013 at 3:13 PM, Mohammadu Ramsath <ramsathm@xxxxxxxxxxxxxxxx> wrote:

Ok, this is whole my work,

1. I have developed my own java client which post , put and get device deatil to rest URI, so i can get and change device deatils (config + provisioning can be done), this works fine

2. For the softaware update part also i use the same mechanism which is available here (but i have small problem with sw update Package,,, i hope i will be able to fix it)
https://wiki.eclipse.org/Mihini/REST_API#defaultconfig.lua

3. Additionol to this  i also running a lua client on mihini side it monitors some variable using "devicetree.register" and trigger some functions, so i will be able to send some control parameters to the small devices such as arduino, zigbee etc.  which are connected to mihini. 

for this third task , i require some additional functions to be implemented like appcon.install, os.exit, that is why i am more concern on rpc at the moment.

however i can call os.exit(1) from rpc client as follows: it works fine
local function restartMih()
  print ('hey ok')


  client, err = rpc.newclient('localhost', 1999)

  client:call('os.exit','1')
end

 

but when i do samething for appcon.install as follows, nothing happens(print statement works), no error messages
local function insApp()    --this function is used to install app for new small device
print('inside swU')


client, err = rpc.newclient('localhost', 1999)

client:call('agent.appcon.install','main1','/home/ramsath/app','true')
end

Is it possible to use appcon.install? in my main script

Thanks

 

 

On Wed, Dec 18, 2013 at 2:14 PM, Cuero Bugot <cbugot@xxxxxxxxxxxxxxxxxx> wrote:

Hi Mohammadu,

 

If really what you want to do is device management I would recommend to use a server (as the one on eclipse) and do remote device management. It is in that configuration that it will unveil the powerfulness of the framework.

(https://github.com/SierraWireless/m3da-server) Last time I mentioned the Lua implementation but it seems that is broken for now.

 

Have a look there http://download.eclipse.org/mihini/org.eclipse.mihini-incubation-0.9/Docs/Modules_Documentation/, and more specifically here: http://download.eclipse.org/mihini/org.eclipse.mihini-incubation-0.9/Docs/Modules_Documentation/agent/Software_Update_Framework.html

In order to understand how the software update framework work.

In that configuration the appcon is already binded to the update framework, so all you have to do is build and update package (see documentation on the format), put it on a webserver, and send the Software Update command to trigger the update. See here for the command http://download.eclipse.org/mihini/org.eclipse.mihini-incubation-0.9/Docs/Modules_Documentation/agent/Device_Management.html

 

 

Regarding your RPC prb, could you attach the error trace ?

 

Another note: I see you use the devicetree API to set your config. It is perfectly OK, but you could also leverage the defaultconfig.lua file in order to statically store your default config.

The default config file is loaded only once at first startup (or after you erase the ConfigStore file located in runtime/persist/ConfigStore.l2b). Some doc on how the config works is avail. here: http://download.eclipse.org/mihini/org.eclipse.mihini-incubation-0.9/Docs/Modules_Documentation/agent/ConfigStore.html

 

 

Cheers,

Cuero

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of Mohammadu Ramsath
Sent: Wednesday, December 18, 2013 8:22 AM


To: Mihini project developer discussions
Subject: Re: [mihini-dev] Appcon module

 

Hi Curo,

again thank you ver much for your explanation, 

I have tried several ways to implement DevieManagement finally implemented some configuration and provisionin operations, now my requirement is install and updates some apps to the device remotely, for that i need to use the functions defined in appcon module,

as you said i tried rpc module to remotely connect to mihini VM and called the appcon function, but still i cannot access those functions,

here is my code, it doesn't work

local function main()
log.setlevel("INFO")
log("GENARAL", "INFO","Device initiated")

devicetree.init()-- configure the module
devicetree.set ("config.agent.deviceId", 'ramshad')
devicetree.set ("config.agent.server.url", 'tcp://m2m.eclipse.org:44900')
devicetree.set ("config.agent.DEVInfo.Man", 'anodize')
devicetree.set ("config.agent.DevInfo.DevId", 'ramsh')
devicetree.set ("config.agent.DevInfo.Lang", 'english')
devicetree.set ("config.agent.DevInfo.Mod", 'r001')
devicetree.set ("config.agent.DevInfo.DmV", 'dm01')
devicetree.set ("config.server.autoconnect.onboot", true)

local devId=devicetree.get("config.agent.deviceId")
local Lang=devicetree.get("config.agent.DevInfo.Lang")
local Man=devicetree.get("config.agent.deviceInfo.Man")
local Mod=devicetree.get ("config.agent.DevInfo.Mod")
local DmV=devicetree.get ("config.agent.DevInfo.DmV")
print(devicetree.get("config.agent.deviceId"))
print(devicetree.get("config.agent.DmAcc.newNode"))
print(devicetree.get("config.agent.DmAcc.reboo"))

devicetree.register('config.agent.DmAcc.newNode',test)
devicetree.register('config.agent.DmAcc.reboo',swUpdate)


client, err = rpc.newclient('localhost', 1999)
for x,y in pairs(client) do
print (x,":",y)
end
client:call('client.agent.appcon.list')

end

sched.run(main)
--sched.run(writebranch)
sched.run(swUpdate)
sched.loop()

can you please tell me how to exactly call appcon.install/appcon.list function using rpc

 

On Wed, Dec 11, 2013 at 4:30 PM, Cuero Bugot <cbugot@xxxxxxxxxxxxxxxxxx> wrote:

OK. Well.

 

So in a typical device management architecture you have devices and a central server that you use to administrate the devices. SWI provide a commercial solution for the server, that you can try for free BTW (https://airvantage.net/)

Mihini is a software designed to run on the device. It is composed of an agent that talk using M3DA protocol that was specifically designed for M2M, and AirVantage solution. It is feature full and bandwidth efficient while providing a state of the art security model.

In addition Sierra also contributed an open source M3DA server stack available here: https://github.com/SierraWireless/m3da-server (Java). It is less feature full than the commercial solution but it provides the connectivity means to do device management. There an already deployes instance of that server on the eclipse site: (tcp://m2m.eclipse.org:44900)

 

For reference, there is also a Lua  implementation under Mihini.Git/tools/LuaPlatformServer. (type make platformserver lua  in the build.default directory, and run bin/lua lua/platform/init.lua in a terminal). You can then login using a browser on http://localhost:9898/)

 

You will have to configure the Mihini agent to communicate with the right server.

(Log in with a  telnet in the LuaVM shell of the agent and check the setting:

> :agent.config.server.url

 

This is not very well documented, it was planned to be done in a next step.

 

I hope you can sort out the details J

 

Thx,

Cuero

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of Mohammadu Ramsath
Sent: Wednesday, December 11, 2013 8:50 AM


To: Mihini project developer discussions
Subject: Re: [mihini-dev] Appcon module

 

Hi Cuero,

Thanks for your response, it was a great help for me to proceed with device management,

but there are also some other api's such as rest api , and m3da commands which i can use for device mangment(what i understand)

could you please tell me what exactly we have to use for device management in mihini, rest api? or lua rpc? or any other?

i also would like to know is there any mihini client module developed to communicate with device management server and execute commands

thanks

regards

Ramshad

 

 

On Mon, Dec 9, 2013 at 4:48 PM, Cuero Bugot <cbugot@xxxxxxxxxxxxxxxxxx> wrote:

Ha Ok I understand.

 

Well the update system was designed for update outside of the system: I mean so that something external to the system could update the system. If you want to do it from within your application it might be a little more complicated.

 

You cannot require agent.appcon in your application as appcon/update is run in the agent VM, and not in the applications.

 

However you can use Lua RPC module to connect to the agent VM and call function from there.

require ‘rpc’, then call “newclient()” API. This object will provide a ‘call()’ method, to which you can give the function name/param you want to call on the remote VM. (the rpc client object is also callable)

 

You may have to look to the rpc code (luafwk/rpc/common.lua) to have more information.

 

This would have the same behavior as when you do the call manually from a Lua shell.

 

Hope that’ll help.

Cuero

 

 

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of Mohammadu Ramsath

Sent: Monday, December 09, 2013 7:05 AM
To: Mihini project developer discussions
Subject: Re: [mihini-dev] Appcon module

 

Hi Cuero,

Thanks for reply,

but, i tried it already procedure described here: http://wiki.eclipse.org/Mihini/Run_Mihini_on_an_Open_Hardware_platform ?

i was able to do that manual part, accesing appcon module and function through lua shell,

however when i tried to include apcon module to my lua app (ex: local appcon = require "appcon") it shows errors

i even tried local appcon=require "agent.appcon" it also doesn't works

my need is , i want to use the functions available in the appcon module such as install, start etc.  to my lua app

can you please help me.

Thanks

 

On Fri, Dec 6, 2013 at 7:43 PM, Cuero Bugot <cbugot@xxxxxxxxxxxxxxxxxx> wrote:

Hi Mohammadu,

 

No you should not need to develop those device management operation as the vanilla Mihini provide application install.

Did you try the procedure described here: http://wiki.eclipse.org/Mihini/Run_Mihini_on_an_Open_Hardware_platform ?

 

Thx,

Cuero

 

From: mihini-dev-bounces@xxxxxxxxxxx [mailto:mihini-dev-bounces@xxxxxxxxxxx] On Behalf Of Mohammadu Ramsath
Sent: Friday, December 06, 2013 12:06 PM
To: mihini-dev@xxxxxxxxxxx
Subject: [mihini-dev] Appcon module

 

Hi,

I have been trying to use appcon module to my lua program which is to be run on mihini,

But i couldn't use it, similarly the update module

do i need to develop those device management functions or else is there any way to access those functions

Thankyou


_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev

 


_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev

 


_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev

 


_______________________________________________
mihini-dev mailing list
mihini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mihini-dev

 

 


Back to the top