Jump to content

Simulator for development


kinfkong

Recommended Posts

You might try this:

https://github.com/PlayWithIt/TFStubserver (without user interface)

https://github.com/PlayWithIt/TFStubViz (a simple user interface)

 

Not all devices are supported yet ... (MotionDetector is supported (also in UI).

 

There is a german description for it with an example:

http://www.tinkerunity.org/wiki/index.php/DE/Projekte/Stackemulator_%28stubserver%29

 

Link zu diesem Kommentar
Share on other sites

@Theo: I'll describe what I've done..

 

First of all, I wanted all concrete TF classes for bricklets to become interfaces. Chiefly so that I could have multiple implementations (e.g. one bound to the real hardware, another bound to an emulated bricklet, a unit test mock, etc.)

 

To obtain those interfaces, I wrote a code generator that parses the official TF JAR, and generates the interfaces, and a bunch of other things (like concrete classes wrapping the TF bricklet classes, and implementing the interfaces).

 

I also wrote a few (not many) emulated bricklets. E.g. the LCD bricklet, various sensors.

 

The end result is that I can write TF applications that are interface-based, and which can trivially switch execution between emulated and real hardware.

 

By the way, it's kind of ironic that my approach is code generation-based, because Tinkerforge also uses a code generator as their foundation for language-neutral description of all their devices.

Link zu diesem Kommentar
Share on other sites

@JavaLaurence,

 

first of all sorry for the delay.

I used a different approach, I think it's more like TFStubserver does it: I wrote a replacement for the brickd.

It's a TCP Server which behaves like the original brickd but with data from emulated hardware devices.

The emulator device classes are generated with a python generator like the other TF language bindings. The generator uses the device descriptions of the TF generator stack. I started the development by rewriting the TF java bindings generator.

Writing over 65 device classes by hand is just to time consuming, boring and error-prone. But writing the generator is also a challenge ;-(.

The core TCP server and helper classes are hand coded. The emulator is still not ready and has a lot of rough edges but I'm preparing a github project to provide some insights. Hopefully I can finish this before going on holidays for 2 weeks.

 

Regards,

Theo

 

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...