Web application and remote raspberry 2 way communication - spring

I'm designing a web application that should communicate with a remote raspberry (or similar devices for what it matters)
I need to achieve these goals:
user be able to send commands and receive answers
device be able to send data on his own initiative
when the user is offline, the application server should be able to get updates from the device
http://i.stack.imgur.com/hHbPb.png
Actually I'm at this stage of designing. I cannot figure out what to put in A and B boxes.
I was thinking about node.js on the B side, and it would work very smooth if I only needed to send direct commands from the frontend, but I also need to update the DB and get the application and the raspberry communicate when the user is offline.
Any ideas?
Thanks a lot.

To answer your question, I need to make few assumptions:
you have chosen SpringMVC because you're familiar with Java,
you read from Raspberry comes in via GPIO pins
you're ok with polling Raspberry for data
you want to narrow down the amount of technologies used
Then this one may help:
http://elinux.org/RPi_Low-level_peripherals#Java_Webapp_GPIO_web_control_via_http

Related

Can I use phonertc to send arbitrary data?

I'm trying to use Phonegap/Cordova to send data between mobile and desktop application and between mobile to mobile via local network (just local p2p).
I've seen that in phonertc I can pick video/audio streams between devices, but what if I want to send regular objects through - or maybe using http://peerjs.com/
This is an old question, and perhaps you've moved on with your requirements; but I think what you were looking for was socket.io P2P.

broadcasting data to mobile devices

I working on a project were mobile users can receive alerts based on diferent factors, the server side will be implemented using the MVC framework.
My question is regarding the client side; what would be the most efficient way to send the alerts to the clients? is there any way to broadcast the alerts to each device or do I have to set up some system where each device pulls the data from the server on an interval of mins/seconds? I am afraid pulling the data every X secs/mins would create an unnesesary overhead on the mobile devices.
One way would be using SMS but SMS gateway services are expensive and not on my budget right now.
I haven't personally tried it, but this service might work for you:
http://www.airgramapp.com/api
It is free for limited use. Downside is it appears to be a separate install on the mobile device. This might means less control of the content of the message or its look. Upside is it looks quick and easy if you just need a proof of concept at this point.

Windows Phone 7 - how to send files from/to the app?

I'm trying to write the most basic application for windows phone 7 and want to be able to send files (specifically XML in case that changes anything) to my app. Currently I have a WCF service setup so I can send push notifications through it. The problem is that there is a limit on the amount of raw data I can send via a push notification.
My solution to this is to send the initial push notification (either tile or raw) to alert my application that I want to send a file to it and then make the app somehow communicate with a server (everything is on my personal computer btw - I'm just trying to figure out how things work) - from which the app will recieve/download the files.
What is the easiest way to accomplish this? Note that I'm not concerned with security or anything like that.
Clarification - the question is essentialy: how do I transfer files from/to a server to/from the phone? Assume everything else was handled - the app is up and running and the user has given or will give permissions to every possible thing he may give his permission to.
Unfortunately, the total size of a push notification (including HTTP headers) is 1kb. This means that it can't be used to send large amounts of data.
Instead of sending the whole file, send a notification (raw or toast—as appropriate) which should be treated by the application as a trigger to go and retrieve the new file/data/whatever from the server. It may also be worth checking for new messages when your app starts. However, if when you start the app it will notify the server that it is ready to receive raw notifications and such messages will be sent indicating new content is available, it may be unnecessary to add this extra check.
To transfer files to/from the phone you will need to use either HttpWebRequest or WebClient as this is the only way to use HTTP on the device and HTTP is the only protocol currently available to transfer data.
While WebClient may appear to be easier to use than HttpWebRequest it is less flexible and will automatically perform it's callback on the UI thread and if you're downloading files in the background you almost certainly don't want this.
There is no way to transfer files to/from a conencted PC and have them exclusively available to your app.
First of all: you won't be able to do this approach automatically - the user will have to open your app to do that because WP7 SDK doesn't allow your app to run on background/start automatically once a push notification is received.
The only way to communicate with your server, at this point in time, is web services. If I were you, I would check for new information available once the app is started, if there is new info, I would call one or more web services which would return me all the information that I need.
If you want, you can use a timer to check for information periodically.
As I said, it will only work while your app is running (check the app lifecycle if you don't know it yet), WP7 doesn't allow apps to run in background, that is a serious limitation IMHO.
Good Luck,
Oscar
Maybe a little bit off topic but when I was thinking about file sharing in my WP7 app, I found two approaches:
Integrate an app with Dropbox
Use advanced explorer for WP7
You can use the WebClient class and the DownloadStringAsync method in order to download data from a web service .
A good example of this is Scott Guthrie's Twitter app from MIX10 .
George

Can Connect to 3G Modem via GSMComm but cannot see any SMS

I'm trying to write an application that receives SMS messages into the app I'm developing (in C# if you care :). Research indicates the best bet is to use GSMComm library.
I've downloaded the library and using the demo app I have managed to connect to the 3g modem (a Huawei E1756) but when I query it for SMS's received it comes back with 0.
Interestingly if I use the software that comes with the application then I can see the messages.
Anyone got any clues on why this would be? Or other tips on how to retrieve the messages?
Cheers,
Kym
Depending on how the modem is setup, messages can be stored on either the SIM card or in phone memory.
I would check that the demo app is looking in both places for old messages.
I use gammu's smsd which can write to a database which you can then use your c# with.
it is supports a wide array of phones and modems including many Huawei models
http://wammu.eu/phones/huawei/
It runs on windows and linux and has worked well for me.
http://wammu.eu/smsd/
the database has a simple inbox and outbox tables that you can use.
Try Clickatell to get an idea http://www.clickatell.com/brochure/coverage.php

application -> database <-> web app communication

I'm working on a personal project that consists of a linux dev board and temperature sensor. I'd like to see a nice web 2.0 real time plot of the tempature from anywhere in the house. Coming from hardware/driver background so i'm not very familar with databases or webservers. I'm stuck trying to figure out how i can send new temperature values from an application to a local web server (also running on the dev board) which can be simulataneously viewed from a client web browser. I've attached a picture which shows what i'm trying to do:
http://img193.imageshack.us/img193/4742/92898822.jpg
I've written the driver, application and played around making an app using GWT. I'm stuck trying to figure out how to make the server-side application and database i.e. Do i need to make a seperate executable that embeds SQL to talk to both application and client via http or is there an easier, existing way to do this?
Thanks in advance.
Kevin
GWT is usually used with a Java application server. You can use JSON or XML to communicate with any kind of server, but I don't know how easy this is.
In a not embedded server you would install Java and an application server. You would also install a database server, but for simple projects you could avoid this by using an embedded DB like HSQL or Derby. For your situation I don't believe this is necessary.
The question is what kind of application server can you use in your platform? All application servers support some kind of CGI communication. This way you could connect your server with the application that samples the temperature values. I don't think there is a need for SQL or an embedded database.

Resources