How is Snap4Arduino implemented?

Well, it's really close to my objective.

One last question about dev stuff: How to bundle snap & https/http service, is there any script (Hmmm.. something like linux shell scritps.) that combines https/http server and snap, and how to do this?

There are no such scripts, but Snap4Arduino Desktop is one such bundle, and it includes an HTTP server, which is described at https://snap4arduino.rocks/ => HTTP PROTOCOL

If you try to use, as a wifi device, Esp8266 in AT mode a kind of http<==>tcp gateway is required (e.g. GitHub - reddec/http2tcp: Expose your TCP application to WEB)

or you can modify S4A and add TCP client blocks.

Thanks for you time and patience. I'm NOT familiar with js and snap4arduino dev, just basic knowledge about C/C++ in embedded dev. So how snap4arduino is launched or started, something like PX4 boot sequence (initialization).

Currently, I have had a glimp of js programming (node blabla.js, like gcc helloworld.c ==> a.out, run ./a.out).
Is there any simple code framework for snap + https/https(js) , very basic /easy code example simillar to snap4arduino .

Or any guide link for me to add code for snap4arduino, such as (USB CDC, Bluetooth SPP)Arduino Component, we call it (WiFi) MSP Component.

I'm not aware of any public low level documentation other than the source code from repo :wink:

I will check if the S4A's "Network serial port" can be abused as a raw TCP connection.

:rofl: Yeah! I hope some with low level coding skill can help me out if there is NO documents.

And thanks for your time. :grinning:

I made proof of concept TCPClient but forgot to publish it.
You should open this link in the desktop version (Open from URL...) with Javascript extension enabled.
This
untitled script pic (3)
connects to a given IP, port and emit a broadcast when some data is received.

Thanks for the demo, although I didn't know much about it.

Currently, I have got Restful server work with snap (post/get) json strings. What I wanna do is:

Is it possible for snap to broadcast a group udp message and server will listen and response to this message (I think server code is easy c code, I can manage it)

"Desktop" means the standalone version of Snap4Arduino . It's Node/nw.js application so you can run native modules like "dgram" for UDP.
I've updated the example.
BTW:
"192.168.0.255" is an UDP broadcast adres of the private IP subnet of my home router.

I changed subnet, apparently mytest environment is still something wrong.

Sorry, new blocks lost its content during save.
I'll recreate it tomorrow.

That's very kind of you. Thanks.

Project updated.

Thanks. With UDP broadcast & RESTful +json & library export, now snap can do our work with SnapAirUnit, which communicates with FC(Flight Controller)

Dear dardoro:

I have met an issue. When I get data from udp server, I can't map this binary correctly to string. BUT I can indeed map list to string.

I'm confused. It should be something like "0.1.cce3787-dirty" :frowning:

TCPClientTest

Log is accumulated for the debug purpose.
To work with the single datagram, store it first.
TCPClient script pic
Most blocks are "hyperized" so they can seamlessly take a list as an input.

:+1: Excellent !!!

It works! :grinning:

I think you've missed @dardoro point about unicode as letter being "hyperised"

Also, do you know about the technique of dropping a list onto the arrows of a join block so that it changes to join input list?

Have a play around - your code will be faster (not important probably here) but certainly shorter and neater :slight_smile:

As a matter of fact, I really don't know much about snap. Just try to make things work, so that I can focus on our SnapAirUnit, which is trying to control the flight controller, like a companion computer.

I hope that I have time to know more about snap. And then I'll do more about visual programming. Hope it will NOT be long.

BTW, is there any idea or concept here, such as thread/process/mutex/semphore? I didn't find in SnapManual.pdf. Or maybe, there is an other definition about this phrases.

Fair enough - I do that myself when using JavaScript - I just want working code - don't need/want to understand it :slight_smile:

Brian (@bh) is the person for those sort of discussions - maybe he'll join in this thread

FYI Snap4Arduino is a bit behind the main Snap! program, so not all features in the manual are available to it

Very Good Point. I think there might be a lot of work to follow the main stream of snap.

So in my opinion, I hope people, using our produt, to follow the main stream of snap language, NOT kind of hybrid re-packed software, which might have much more hiden detailed design.

We are trying to use moduler design concept, and divide modules by application programming interface.

Currently, we are trying to use RESTFul API to de-couple the flight controller(Open Source, of course) with Snap. I also hope we can do more advanced flight actions to make flight happier.