9

What are the common or usual APIs (or libraries) in C or C++ for the IoT, in the sense of having a documentation, a set of programming interfaces? (Like e.g. POSIX is for operating systems, Qt is for GUI, etc....).

This short page motivates my question (I'm interested in developing static source code analysis tools for IoT). I'm not only looking for legal standards, but also for commonly used APIs or libraries -in C or C++, with existing header files for them- in various industrial domains. I'm not interested in Web APIs (conventions defining some HTTP requests) or just in network protocols without any API or library implementing them.

(so I am not interested in developing myself IoT applications, but I want to develop software engineering tools working & analysing source code to help developers of IoT software)

I could even be interested by industry specific IoT APIs or libraries, e.g. in healthcare, logistics, transportation, smart grids, smart buildings, etc; as long as as it is a C or C++ API or library.


I am in a research group working on static source code analysis, and we would like to develop tools analyzing C or C++ source code, to help the IoT software developer.

However, I need to find out a way to be funded before working on this.

We suggest to develop a specialized tool (preferably open source, above existing technologies), for developers & engineers writing source code (in C, C++, and Ada if needed...) targeting IoT platforms. This tool will be integrated in the targeted software development kit. This tool could assist IoT software developer by analysing and checking the validity of the source code against coding rules, invariants, and good practices specific to these software frameworks. The main objective is to enhance the software quality and to accelerate the time to market. If relevant, the tool could perform specific source code optimizations to enhance the software performance and/or to decrease the code size.


NB. This IoT Eclipse webpage is listing several standards. I am interested in APIs & libraries implementing them (and any other IoT de facto domain specific standard), if developing source code analyzers for them is worthwhile.

  • @Basile Will this be commercial or FOSS? In any case, is there any way that we can follow your progress. I realize that might take months, or even years, so a UTL to watch or a mailing list would be very welcome – Mawg Feb 22 '17 at 9:44
  • I am mostly working on free software since a dozen of years, so I hope it would be FOSS. However, I need to join some consortium (or to get some R&D grant, or any other funding) to begin working on this. – Basile Starynkevitch Feb 22 '17 at 9:48
  • 1
    Do you mean things like CMSIS? keil.com/pack/doc/CMSIS/General/html/index.html – pjc50 Feb 22 '17 at 12:25
  • 1
    MQTT and Mosquitto is quite popular when it comes to IoT. Maybe the Libmosquitto API is a good target for your code analyzer? – Bence Kaulics Feb 22 '17 at 14:10
  • 1
    Is there any aspect of IoT in particular you're interested in? There's the communication side as Bence Kaulics suggested (MQTT, CoAP, 6LoWPAN etc) or there are entire IoT platforms like Android Things or Ubuntu IoT. Which part do you want to tackle? – Aurora0001 Feb 22 '17 at 15:00
8

Basile, I think that we are missing a fine distinction here.

When you speak of a Posix like standard for IoT, I think that you are speaking of libraries which wrap a protocol.

As one who has been employed for (cough) decades implementing protocol stacks for telephony and satellite communication, I can say (as you are probably aware) that these protocols are, by need, already strictly defined. For instance, Zigbee is governed by https://en.wikipedia.org/wiki/IEEE_802.15.4

These standards lay down the messages to be transmitted and define that byte 0 means this, bytes 1 through 4 mean that, etc, so that devices from disparate manufactures can communicate with each other (that’s the theory, anyway; I could tell you some horror stories ;-)

As I said, for any given protocol, there can be a plethora of manufactures. And for any given manufacturer, there can be multiple software libraries, which is your problem.

Your task is too difficult as long as there are multiple APIS available, which wrap each protocol.

Sadly, there will only be a Posix-like API only if one company becomes dominant. There might be a thin possibility if a major government throws a lot of money at it, but I can’t see that happening. The only other chance I as Linux-like effort by the Open Source community.


Btw, I don’t think that you make it clear enough that your will not be just another static code analyser, that it is not intended for general code, but for certain specific APIs. You do say that, sort of, but not explicitly enough, IMO. When you define that exactly, you will know what your project really is. If you already know, you don’t seem to emphasize it (but maybe I am not reading well enough, rushed between two meetings).

The syntax of POSIX APIs is policed by the compiler, as will be the syntax of any APIs which you study. So I guess that you are looking for potentially dangerous code , such as use of unitiatlized resources, not freeing allocated resources, etc – is that correct?

It sounds like a great project, though, and I have starred this question.


enter image description here

  • 1
    I am more interested in the semantics of the APIs (not only or mostly of their syntax). And yes, I would like to analyze code using that API for the things you mention (and much more). This is currently just a rough idea (and I will adapt it to the needs), and I'm still trying to find ways (notably collaborative R&D projects) to get it funded. – Basile Starynkevitch Feb 22 '17 at 10:13
  • BTW, the Qt example shows that an API (and a library) can become important -and perhaps dominant- even without being a legal standard. – Basile Starynkevitch Feb 22 '17 at 10:15
5

The standards for various networking protocols are already well defined. What it sounds like you're hoping to find is an API implementing standard behaviors inherent to IoT devices. Something like a Light() function that can turn lights on, off, or dim them to a fraction of their brightness; DoorSensor() that can be armed or disarmed, or can register for an alert on door open or door close events; that sort of thing. However, I am not aware of any API library that isn't application specific.

If anyone has one, you might find something in Domoticz. It's an open source home automation controller written in C++.

5

As quick response, I don't think that for IoT there is a special type of library, I would say that IoT is basically the "new embedded systems", they just changed the name and added the connection to the cloud.

So answering to what I use for C++ programming, my reference page is http://www.cplusplus.com/

Basically for IoT you will need communication libraries, whatever protocol you uses (USB, TCP/IP, UDP, ZigBee, etc, etc.)

In addition, if you have communication then you need security/encryption.

And the rest will depend on what part of hardware you are controlling or measuring. You will need the libraries (API/Firmware) for such hardware.

Surely there are many things I am missing here... let's see others answers

  • 2
    So basically, you are confirming my gross intuition that IoT is just the new buzzword for embedded computing, probably embedded Linux systems? – Basile Starynkevitch Feb 22 '17 at 8:19
  • @BasileStarynkevitch It depends on the device class. Fitness trackers (as opposed to watch mounted phone extensions) do not run Linux. Self-powered nodes do not run Linux. Hub nodes, which perform distributed sompute) probably do run Linux. Hence my talk of a stack extending from edge to the cloud. – Sean Houlihane Feb 22 '17 at 8:59
  • 1
    That is ok. So what are the commonly used APIs or libraries on these devices. – Basile Starynkevitch Feb 22 '17 at 9:03
  • 1
    Since ZigBee looks like a network protocol, it is out of scope. However, a commonly available API in C or C++ implementing ZigBee would be interesting – Basile Starynkevitch Feb 22 '17 at 9:10
4

Embedded, plus secure communications, plus provisioning (device management) plus OTA updates. This is a big software package and also emerging as a new type of platform for developing on.

There are several providers offering cloud solutions, they will typically have their own client APIs and chosen endpoint operating systems.

As far as I can tell, the various wireless protocols do not really dictate any particular software stack, so your choice needs to be driven by the big picture, not the client APIs. One deciding factor may be if open-source is important for the stack in your application.

  • 1
    I'm not developing IoT applications, but I want to develop static source code analysis tools for the benefit of IoT software developers. – Basile Starynkevitch Feb 22 '17 at 8:19
  • 1
    OK, so there are (guessing) 4 or 5 different stacks that are relevant and you need to consider all of them if you want to be following whichever two or three become dominant in a few years time. – Sean Houlihane Feb 22 '17 at 8:56
  • 1
    What precise APIs or libraries (in C or C++) are you thinking of? Please name them in your answer! – Basile Starynkevitch Feb 22 '17 at 9:04
  • 1
    if you happen to know some team working on such APIs please forward them my question and point them gcc-melt.org/IoT-03-interest-Starynkevitch.html – Basile Starynkevitch Feb 22 '17 at 9:15
3

I think your objective is somewhat similar to BOOST:

Boost C++ Libraries

They aim to establish "existing practice" and provide reference implementations so that Boost libraries are suitable for eventual standardization.

Perhaps Boost could be a major player in IoT: it certainly has made some great improvements to C++.

2

IoTivity is the reference implementation of the OCF Specification. You can find documentation and source code at their GitHub repository.

From their list of features:

  • Core functionality written in C for deployment to constrained devices
  • Most functionality available from C and C++

Their Framework APIs allow discovery, data transmission, data management (collection, storage and analysis) and device management (e.g. provisioning, diagnostics) over various protocols such as Bluetooth, Wi-Fi, ZigBee and Z-Wave.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.