telosystools

Open full view…

Code generator for Arduino according to a UML model

andressolis
Tue, 30 Mar 2021 19:58:49 GMT

Hello, how are you? I'm resuming a project to create a code generator for Arduino, the issue is that my knowledge of the MDE is quite limited, and developing I understand the basics. Now, obviously I'm understanding the tool little by little but I don't understand yet in my head how I can translate a class diagram that I made in the tool. Does anyone have an idea of how to implement at least one class or guide to get started with telosys? Obviously the code is going to be done in Arduino, but if I wanted to implement a specific sensor for example how could I do this? because I can only see that classes are generated from the template code. [Diagrama de clasesaaa](//muut.com/u/telosystools/s3/:telosystools:ucdQ:diagramadeclasesaaa.jpeg.jpg)

Telosys Team
Thu, 01 Apr 2021 10:14:16 GMT

I'm not a specialist of Arduino, but as far as I know, very often an Arduino sketch is very simple an only composed of : list of variables, "setup" function and "loop" function. Which is too simple to justify code generation. But, if you have a class diagram I suppose that you plan to use an Object Oriented approach (that seems possible as the Arduino Language is a variant of C++). According to you diagram, each class ( "Sensores", "Actuadores") can be assimilated to a "Telosys Entity". Thus you can create a Telosys DSL model with 2 ".entity" files ( "Sensores", "Actuadores") and use them to generate your code (class attributes, constructor, common methods, etc). But if a large part of the code is specific to each class then there is no real gain in using code generation

andressolis
Mon, 05 Apr 2021 01:14:41 GMT

Thank you very much for your response. Sorry for the delay in replying. I am trying to understand how telosys works, is there any initial tutorial or documentation to read about the tool. Also, I have another question. I can represent "sensors" and "actuators" through .entity files, now is there any way to also create the implementations of these classes, for example, some command line menu or other way that appears and asks the user, how many implementations of the sensors class he wants to create, and I generated in code?

Telosys Team
Thu, 08 Apr 2021 14:28:03 GMT

If you want to generate implementations you need a template for this. For example you can define 2 templates, one template to generate an "abstact class" (or "interface") and another template to generate the implementation (or concrete class)