Saturday, 22 August 2015

Symbol Hound - The search for devs.

During the course of the last week myself and a college came across an exception in our logs. The exception was from JSON.Net complaining of an unexpected character in the JSON string.  The character in question was the ^@ symbol.  A Google search for this symbol shows up very unhelpful results, you could try Carrot @ or Carrot At.

We went looking for ways to search for symbols in Google, in our searches we came across http://symbolhound.com a search engine for developers. It doesn't ignore symbols so a search for ^@ yields much more useful results and reveals that its a null character. It's a useful tool for debugging and development questions, you can even set it as one of the search options in Firefox.

Saturday, 8 August 2015

IoT Identity

The first IoT topic I want to look at is Identity.  Identity is critically important when selling an IoT product. It doesn't seem such a big problem when playing with half a dozen Raspberry Py's in the back room of your house.  But when customers start sending back error reports and/or hardware knowing exactly what they're talking about becomes very important.

This problem starts with the what is Identity?

Consider the example of a taxi management system.  We've all been in a taxi lets make the meter a smart meter.  It knows all about the taxi, speed, distance tally, fair total, etc and can be tracked at via a web service.  What the problems the system solves is not important for the example, what is important is that the system is installed into the car as an after market component and that it provides data about the taxi to a central service.

And now we come to the question of identity.

The first question to ask is "When do you need to identify a device?" There are three cases I regularly encounter:
  • In reports and dashboards. 
  • To the central service and each other.
  • In Exception Cases
The next question is "What do you use as identity?"

The when cases break easily into two groups based on who is consuming the information.  The first case is the output of the system, we can assume that whoever designed this system wants to be able to see accurate information about the fleet.  So they're going to want to use their names for the vehicles, "Taxi 67", "Billy's taxi", however they refer to them. So the first identity is the clients language, something easy for humans to understand.  I'll call this the real world identity.

The second when case is when identifying the to other software.  In that case some sort of unique identifier that is easy for software to understand. Probably a GUID.  I'll call this the software identity.

The third when is when something has gone wrong.  The easy answer for this case is just keep using one of the previous two identifiers.  The problem with the easy answer is that when an IoT solution is in production minimal down time is important.  To achieve minimal down time it's common to have a collection of "known good" spare units is held in a state ready to be physically swapped for and configured to replace any problematic unit. `

This would mean that now the software identity and real world identity are potentially associated with a different piece of hardware. This makes fault finding difficult if the problem is hardware or firmware related.  So obviously to solve this problem we need to introduce the concept of a hardware identity as well.

So to correctly identify an IoT device we need to know the real world identity, the software idenitity and the hardware identity at any given point in time.

Building an IoT product is hard.  Making an IoT solution work in production is harder.  Before deploying make sure you've gone through all the possible exception cases and have a good plan for maintenance, because no system ever survives first contact with the enemy customer.