10

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.

6 Answers6

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

Mawg
  • 3,147
  • 1
  • 13
  • 35
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

anonymous2
  • 4,902
  • 3
  • 22
  • 49
Snake Sanders
  • 961
  • 1
  • 6
  • 12
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++.

John Deters
  • 2,552
  • 13
  • 21
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.

Sean Houlihane
  • 10,524
  • 2
  • 26
  • 62
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++.

anonymous2
  • 4,902
  • 3
  • 22
  • 49
serup
  • 147
  • 3
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.

Aurora0001
  • 18,520
  • 13
  • 55
  • 169
thiagogcm
  • 21
  • 2