Connecting 4D with the real world – IoT & Home automation

Originally published at:

Connecting 4D with the real world – IoT & Home automation

1 Like

Thank you, Thank you, Al Mahdi,

1 Like

Excellent presentation!

I appreciate how you started with a split-screen live demo (you, 4D for iOS, Arduino in the room with servo, LED and sensors). You grabbed my attention immediately. I was constantly tempted to buy electronic parts online while watching your show…

You make good use of Schema made with and the slides are clean, simple and easy to understand.

Even though this is technically not a “4D for iOS” presentation, I think you make a good case for how the feature could be used to create simple, practical application for very specific needs.


It was a pleasant surprise that in the presentation you also talked about abstraction of mutually exclusive operations using a Shared Worker. Not only that, you also touch on project mode and headless mode. For a 36 minutes presentation, you surely cover a lot of interesting topics!

But above all, I like that you embrace built-in features such as 4D for iOS “actions” and write minimal code, focusing on the practical applications of IoT.

Great job!


In your presentation, you suggest to use “Native byte ordering” for sending data from 4D.

I had to remind my self, what is the endianness of “Native byte ordering” passed to LONGINT TO BLOB.

Note to forum admin: I think the syntax highlight is incorrect for hex literal. Try 0xabcd


LONGINT TO BLOB($int;$data;Native byte ordering) //34:12:00:00

LONGINT TO BLOB($int;$data;Native byte ordering) //78:56:34:12

LONGINT TO BLOB($int;$data;PC byte ordering)  //i386 = LE 78:56:34:12

LONGINT TO BLOB($int;$data;Macintosh byte ordering)  //ppc = BE (note: 4D for mac was ppc until v11) 12:34:56:78

So “native” is synonymous to “little endian” today.

I understand you are using LE because we want to think in bytes, but because the data is stored in a 32-bit integer, you want to promote the least significant byte to first place and ignore the rest. That makes sense, but here is another way; use a BLOB and access each byte directly.

SET BLOB SIZE($data;1)


In your presentation, you mention 4D Web Server, which is true for web-enabled 4D applications in general.

But for completeness, I would like to point out that “4D for iOS” uses a client connection license in deployment, so a 4D Web Server (application) license is not necessary for 4D Server.

It’s a commercial arrangement, I understand that from a technical point of view, it make more sense to mention “4D Web Server” like you did.

1 Like

Thanks, Miyako for your constructive feedback. This is a use-case that can indeed be further polished on the same line of your comments.
Looking forward to continuing the work.