Update: July 6, 2018
OCF held its first successful Hackathon at the OCF Members Meeting in Chicago on June 21-22, 2018. Open to both members and the general public, OCF debuted a complete and innovative set of development tools that allowed participants to build a complete OCF IoT hardware prototype that could be controlled by a smart phone. In 24 hours, with the assistance of several experts, free food and caffeine, teams produced several original OCF IoT devices that could be utilized in everyday life. Examples of the final device prototypes include a Smart Pantry, and a Smart Dog House. Thank you to everyone who participated and who helped make this hackathon a success! For more information on the developer kit and links to the presentations, visit https://openconnectivity.org/developer-kit.
Some of you may have heard of our upcoming hackathon at the OCF members meeting in Chicago. This is open to all (you don’t need to be an OCF member) and is free! If you can be in Chicago on June 21 and 22, you should sign up.
Why should you sign up? Because it is going to be a blast and we are debuting a complete and amazing set of development tools that allow you to build a complete OCF IoT hardware prototype controlled by a smart phone in 15 minutes! Actually, I’m being generous. It’s closer to 11 minutes for a fresh device and 2 minutes each time you make changes. (Also, there will be free food at the hackathon.)
Here is what we have (for development on the Raspberry Pi):
- The oneIoTa.org crowdsourcing tool for OCF resources. These resources will be pulled into the development for whatever sensors and actuators your project needs.
- A single script that will build a complete OCF IoT development system (including MRAA libraries for control of sensors).
- A DeviceBuilder script that will take a simple JSON description of your device and build:
- IoTivity source code for the server.
- An introspection file that will generate the GUI interface.
- An onboarding file that will set the security for your device.
- A PICS file that will be used to run the compliance tests.
Once your development system is built, there are several scripts that make the development cycle easy:
- gen.sh - Reads the device description file that describes the resources in whatever you want to build. From that, it reads the needed resource definitions in oneIoTa and builds everything you need for a complete OCF device.
- build.sh - Runs scons to compile and link everything and copy it to the right directories.
- edit_code.sh - Loads the server.cpp source file into the nano editor so you can add your custom code to interface with the hardware. Examples for a couple interface boards are included.
- run.sh - Runs the server executable.
- reset.sh - Resets the onboarding state to RFOTM (ready for onboarding transfer method - so, unowned). This allows you to test the secure onboarding process.
After you run through the development cycle, you will have an OCF compliant device. But how do you know if it works? That is the really exciting part.
OCF has designed and built (OK, we paid someone to build it) what we have cleverly named the Onboarding Tool and Generic Client (OTGC). This has two primary features: a tool for securely onboarding a device and a generic GUI client that is automatically generated from the introspection file of the device.
That’s right, you get a ready-built Android application that runs on your smart phone. It will automatically discover your new device on the network, show you that it is ready to be onboarded to your network, then do the secure onboarding process (several onboarding methods are supported). Once it is onboarded, you will be able to control it, but nobody else will have access without your permission.
The onboarded device can now be selected and the OTGC will read the introspection file and generate a GUI for you with switches, numeric and text fields, etc. You can immediately control your device without doing any programming of a client. Currently, the OTGC is in development and is available on Android only (and only available to hackathon participants), but it will be generally released in the fall on Android, iOS, Linux and Windows. The OTGC will be available as open-source, so you can just take it and use it as a basis for your custom client.
At this point, you have a working OCF client that can be securely onboarded on your network and completely controlled with a smart phone app and does - nothing.
OK, not really nothing. You can see debug statements from your server and see that the buttons and switches all work, but what you really want to do is control the world - or at least the small part of the world that is connected to your OCF device.
This is where you need to add your own custom code to the code automatically generated with the tools above. For this purpose, we have included a full copy of the MRAA libraries (more information here: https://iotdk.intel.com/docs/master/mraa/) that you can use to control the hardware. At the hackathon, this will be through the GPIO connector on the Raspberry Pi device. We have included a few examples so you can see how to do it, but what you do is limited only by your imagination. The hackathon is where you can add your own magic by coming up with ideas and implementing them. Several experts will be on hand to help you with the implementation.
But wait, there’s more.
In addition to a pre-release of the OTGC, we will also be premiering a low-level development client called DeviceSpy. It runs on Windows and allows you to onboard devices and directly manipulate the payload that is sent to the server. This is very useful if your device doesn’t work as planned the first time you try it.
Finally, we have a Compliance Test Tool (CTT) that reads the PICS file generated above and runs your device through the battery of tests that determine whether it can be a certified OCF device or not. This automated test tool is very thorough. It runs hundreds of tests to make sure you’re doing things correctly (which is likely since we generated most of the code for you).
The best part of this is that you can truly create a brand new hardware prototype of your OCF IoT device in under 15 minutes. That is a device that is supported by the hundreds of member companies in OCF. That is a device that can interoperate with other popular ecosystems. That is a device that is secure and can be certified by several approved test labs around the world. That is a device that is based on tested IoTivity open-source code.
Most of the tools described above are either directly supported on multiple operating systems and platforms or are templatized to be adapted to any OS on any platform in any programming language. If you are interested in supporting a particular platform, we encourage you to get involved and help us adapt the tools for exactly what you need.
Here are some other key points:
- oneIoTa is used as the definitive source for all resource models. Any resources in oneIoTa can be used. If you need something that isn’t available, you can submit new resources to oneiota.org.
- All you need to do to define a complete device is write the device description file (JSON). All the necessary resources will be automatically pulled in and all the necessary files automatically generated and put in the correct directories.
- Currently, we are using IoTivity in C/C++, but all of the scripts are templated, so it’s easy to convert to any language on any platform. We have currently tested the entire tool chain on Windows, MacOS, Ubuntu and Raspbian. We are looking at node.js as a possible next language. A couple of BIG companies are planning to support their own boards that are more likely to be used in real products.
- The tools generate logs so you can debug any problems.
This is an exciting and complete development system (OK, a debugger isn’t really integrated yet, but feel free to help set this up). I encourage everyone to try this. The current example code supports the demo hardware (Pi and Pimoroni Enviro pHAT and Automation pHAT daughter boards). We used the Enviro pHAT board for our demo kits at CES, but the CES kits didn’t use most of the cool tools described in this blog. For the new tools, you should attend the hackathon or stay tuned to openconnectivity.org to see when they are publicly released.
Unless you are at the hackathon, some of these tools may only be available to OCF members, so if you aren’t already signed up, you should do it. There are free membership levels for individuals and non-profits organizations.
Again, if you can be in Chicago June 21 and 22. Sign up for the hackathon (register here or view more details on the OCF events page). It’s free with free food, cool goodies and bragging rights for having participated in the first OCF hackathon.
OCF is architected to support security and interoperability. With these new tools, it is designed for incredibly fast and reliable development. We want you to witness this and become an OCF developer. Then tell your friends.