Are there any code examples available for AWS Freertos for implementing a DHCP Server and HTTPS server? - aws-iot

I am wondering if anyone know if there is any sample code for implementing DHCP server and https server for AWS Freertos or if not then maybe for Freertos? The purpose for this is purely for WiFi provisioning so a lean implementation would be what I'm after.
My device is a PIC32MZ-W so it has built in Wifi (using Bluetooth for provisioning is not possible as it is not supported by this device, at least not without additional hardware).
I've searched both AWS Freertos and Freertos, but as far as I can see there are some comments on it but no guidance or examples seems to be readily available.
Thanks,
Marcus

There are plenty examples in the freeRTOS default folder that you can download from the offical website ( https://www.freertos.org/a00104.html ).
One of the examples would be here: \FreeRTOS-10.0.1\FreeRTOS\Demo\lwIP_Demo_Rowley_ARM7\lwip-1.1.0\src\core\dhcp.c

Related

How to use Firebase on Cortex-M embedded system

I'm just starting a new project, a thermostat connected to wifi and controlled anywhere from mobile phone. I've seen the Nest Thermostat which has a Cortex-A8 but I need to make a simpler and cheaper one, just a Cortex-M3 + wifi + temperature sensor, no screen.
The Android app (developed by other people) uses Firebase, so my embedded system should use it.
I've selected a tiny RTOS, CyaSSL and lwIP, but this is my first Internet project and I need help with Firebase and everything related to Internet.
Is a Cortex-M3 suitable to connect to Firebase?
Is the selected software suitable to connect to Firebase?
What software do I need besides the selected? (Firebase API REST, JSON parser... and any software I don't even imagine)
I haven't found almost any info about such a system, there are some questions but most of them have no answer.
Thank you in advance
As I understood, to use the REST API you just need to implement the HTTP protocol, there is many RTOS that have full HTTP and HTTPS implementation.
I never used, but I know that mbed (http://mbed.org/) is designed for IOT,it is free, and developed by Arm, so it is probably the best way to go.
Just look for a C/C++ JSON Parser lib if it is not ready, otherwise you should develop one for yourself, it looks pretty simple.

establish bluetooth piconet connection between server and two clients using c on linux platform?

I want to establish Bluetooth network where one server can communicate to two clients (ie piconet) using C programm on linux platform, rfcomm based communication.
Can any one please share your guidance or sample source code if have.
I newbie to the bluetooth technology, have not found any useful info or code from internet source so far. so please.
Thank you
Basu
Linux runs open source BlueZ Bluetooth Stack, which works quite well (unless you need Bluetooth Low Energy). You can check out this tutorial: http://people.csail.mit.edu/albert/bluez-intro/c404.html
PS. Mind the GPL license when using #include like in those examples.
Edit:
As for creating piconet specifically, I'm afraid I don't have any snippets. However, after quick search, I would look into using bluez library to open not one but many RFCOMM sockets. So you can listen to and accept multiple connections.

How can I observe network traffic from my browser when using the Mac OS?

I am used to using Visual Studio and Fiddler to watch network traffic on a PC environment to and from my AngularJS front-end. But now I started to use WebStorm.
Can someone tell me are there tools like Fiddler that run on the MacOS that can show me network traffic?
Sadly, I've not found a tool as nice as Fiddler since leaving the Windows environment. I usually use Chrome Dev Tools network tab instead, though that's not quite as good. There are a couple network monitoring tools, but the free ones I've tried were more at the packet level than at the HTTP level like Fiddler.
From https://superuser.com/questions/42813/looking-for-http-debugging-proxy-for-mac-similar-to-fiddler-on-windows
Use Chrome and navigate to chrome://net-internals/
It allows detailed analysis and dumps.
Hope this is what you need.
What about chrome bandwith monitor? It is tool built in chrome, but you would have to open your angularjs page only and disable extensions i guess.
Are you talking about protocol analyzers (which allow you to sniff packets flying around on your network)?
If so, WireShark and Packet Peeper and Cocoa Packet Analyzer are available. I think these all are free.

Arduino Due HTTPS Support

In previous versions of Arduino, the limiting 8-bit microcontroller board, it seems that implementing HTTPS (not merely HTTP) was almost impossible. But the newer version of Arduino Due provides 32-bit ARM core - see spec here.
I tried to check several network libraries (libcurl, openssl, yaSSL), but I didn't find anyone that was already ported to work with Arduino Due.
OpenSSL is probably too heavy to be able to run on this processor, but I believe that yaSSL as an embedded library should be possible to do.
Do you have any information of a library that I can use to trigger HTTPS requests on Arduino Due?
Unfortunately this is too long for a comment.
► No out of the box solution
From what I have gathered, there is no straightforward solution for a webserver running on the Atmel SAM3X8E ARM Cortex-M3 CPU that outputs HTTPS out of the box.
Texas Intstruments provides better options at the moment using their boards equipped with a Stellaris Microcontroller ARM Cortex-M3 CPU.
► Alternative
There are several options available that render cryptographic functions, based upon which one could lay out and implement a simple secure communication protocol that communicates with an intermediary device, which in turn facilitates Rapid Application Development and SSL.
This intermediary device, for instance an off-the-shelf 70$ Android smartphone that keeps your project mobile and connected, runs a service on a specified port which in turn communicates with Amazon SQS. Already available. This may sound ugly or tough, but is much easier than doing the programmatic groundwork for a webserver with full TLS 3 support on the Arduino. Given the proper motivation the latter may be easy, but not if one just wants a fast pragmatic solution to one's own project.
► Cryptographic libraries
crypto-arduino-library http://code.google.com/p/crypto-arduino-library/ (not maintained since 2010)
matrixssl
mbed TLS (formerly PolarSSL)
wolfSSL (formerly CyaSSL)
► Discussions
Following is a list of discussions to get you started:
HTTPS alternative on Arduino
SSL from a Microcontroller
Lightweight Packet Encryption
Many of these libraries would still need to be adapted, but community experts can help you with that fairly quickly.
Good luck! If you are at liberty to upload your final project to github then you just gained a thanks and a follower.
IMHO Arduino (including the DUE) is the wrong tool for heavy and/or encrypted web based communication. I would strongly suggest to look for more appropriate hardware in the same size and price range. As soon you get into https you are close enough to also want a lot of the other stuff that real operating systems provide. With other words I suggest to go for something like the Raspi. Similar size and prize but way more powerful, especially it can run Linux. --> HTTPS becomes simple.
The big problem with https support on an arduino is the danger of overloading your processor which could make the project unviable.
Even embedded platform targetted solutions like PolarSSL can eat up too much memory and use too much processing power. Remember that even on the most streamlined implementations, SSL support is going to have to be generalized for wide adoption and will include components that you won't find necessary. There's also the question of which Certificate Authorities you will trust and how you will communicate with them for things like certificate revocation.
I would look instead towards a solution that isn't as broken on the surface for your needs. Something like CurveProtect, which is an implementation of CurveCP.
Of course, your decision will largely be based on what you want to do and how much time you want to spend figuring the problem out. PolarSSL has a footprint that can be as small as 30K (more typically close to 100K).

Chat *Server* on Embedded platform

I am currently building a chat server (meebo style).
The architecture is something like this.
Bitlbee over libpurple is on host B. Its a trivial server on data center.
User communicates with bitlbee via web server (just like meebo) on Host A. The backend of this web server maintains chat session. It just translates the user commands to proper bitlbee comamnd and sends back to host A.
The most important part here is that host A will be deployed in embedded Linux.
I have 2 questions.
To keep the chat session persistent I am thinking of using node.js. As its much more easier to create a real time application with persistent connection. But I doubt if its supported in such platform.
If I use C instead of node.js (I am not using any web server) I can talk to the irc server at host A by libirc. But how do I implement all the web server features in C (like session, url/cookie/post data parsing etc) ?
Also if you think my approach is wrong or there is a better approach please tell me how can I improve this architecture?
Note: This is NOT a high volume chat server.
If building V8/Node.js is prohibitive on the embedded platform, the next best thing would be to take the event loop and platform layer (libuv) and HTTP parser (http-parser) of Node, both written in C and use those as a starting point. These are the same libraries used to build Node.js so they are battle tested and will give you the performance characteristics you seek.
Ryan Dahl, author of Node.js, demonstrates exactly how to use libuv and http-parser to build an asynchronous web server in C.
Put a ZNC server between Bitlbee and the web-based IRC client. Bitlbee will think that the user has never logged out and ZNC can maintain a backlog of messages until the user connects again with the web client.
I would try to go with node.js if that is your choice, also what embedded system is it? As knowing that would help more. Also, another plus for node.js is that it does have session handling built it, but if you wanted to do it in C try and see if you can get a sqlite wrapper running on the embedded device to store the session information.
But, if possible stick to something with less work on embedded devices, feels bad to reinvent a lot of stuff or have to fiddle with compile issues for your device.

Resources