Posted 15 March 2014 - 05:53 PM
Posted 15 March 2014 - 06:26 PM
Not sure what Unity is, but as for config files, I use a .cs file that I then "add->existing item" to the project.
In the .cs file I have a class with everything I might need to change - like GPIO pins, constants and IP addresses.
The class in that file is within a namespace called config - or maybe config_1, config_2, etc. if I have multiple configs.
In my main code, I have a using statement to allow access to the class members.
Hope this helps - Paul
Posted 15 March 2014 - 10:45 PM
Posted 16 March 2014 - 07:07 AM
Well you (I) learn something new every day.
I only dabble in C#.
Thanks - Paul
Posted 16 March 2014 - 08:43 AM
Posted 16 March 2014 - 05:11 PM
I am not aware of any DI frameworks for NETMF. You may be able to compile an older version of Ninject for the NETMF. Though you may want to re-evaluate your app architecture. While the benefits of using DI on a desktop / web app are widely known, writing code for am embedded device does, and in my opinion should, take a drastically different approach.
These devices are severely resource limited as compared to a desktop / web app. The entirety of your available code space is only 384k on a N+2, the Ninject 4.5 release is 125k by itself. That is a significant amount of code space loss just for a DI framework; additionally, the additional memory requirements for loading and housing the DI framework also needs to be taken into account.
If you still feel the need for DI is there, then your best bet would be to roll your own lightweight DI framework, just keep in mind there is no generic support.
As far as config files go, the easiest way it to put an SD card in it, and serialize / deserialize your own format and structure.
Posted 17 March 2014 - 03:36 AM
Thanks for the input.
Posted 18 March 2014 - 11:33 PM
No I completely understand, one case where I could see DI being helpful is if you wrote stubs for devices for use in the simulator instead of debugging on the real hardware. Really rolling a very simple service locator type of DIish is not that hard in that case.
You are right, I feel very comfortable in the dev environment but every once in a while I will have to stop and rethink an approach to a task based on supported framework pieces.
Posted 19 March 2014 - 11:12 PM
Posted 20 March 2014 - 03:18 AM
Agreed, even though I do not use full DI, all of my netduino app still have very string OO in them.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users