Author
Topic: Java DCE Implementation (Read 3043 times)

I have been beavering away for the last week or so on an implementation of the DCE protocol in Java.

I now have a version mostly ready(possibly), so I thought I would present it for review.

The basic reading of the binary stream is derived from the TivoOrbiter code in svn, and the docs on the subject in the wiki.

I have developed a library that is intended to be usable on both JavaSE and Java ME (MIDP 2.0 via network sockets, not bluetooth).

In order to do this, without hobbling the api to java 1.3 and the ME subset, I've developed the core library in java 1.3 (and ME subset), and then created 2 'profiles' (I'm a java dav, gotta follow sun on this . .) SE and ME.

So I have 3 jar files :- jdce-core.jar jdce-me.jar jdce-se.jar

The 2 profiles provide the API for the device programmer, the core library does the heavy lifting, and is shared. The 2 versions of the API are very similar, but the SE one uses generics, the collections framework and enums, the ME one . . doesn't.

To get a hold of this library, since this is targeted at developers only, you must check it out of sourceforge subversion.

Within the jdce directory you will find the 3 libraries, 2 example devices (one SE, one ME) and an ant build file.

To compile all the libs and devices run ant (see below to get J2ME compilation working)

Examine the device source code for usage, feel free to dig into the library source as well.

This is all quite lightly tested, and likely won't work(see the magic numbers below) It is not release quality, please don't view it as anything more than highly experimental code.

Please note that this is not, and will not be included with the LinuxMCE 8.10 release. it may (going off brief conversations with the devs) be possible to includ it with future versions of LMCE if it is shown to be popular enough and above all stable. So by all means send me bug reports and ideas for improvements.

Please don't hassle the regular devs with this, they don't know anything about it, and won't be able to help you.

Before you submit a bug report about the 'magic' numbers everywhere, I haven't yet implemented scraping the DB for the reference information (a la sql2cpp). I will be doing this as a priority and integrating it into the ant build. At present, this means that command/ event id's, parameter id's etc are hard coded into the source, and are from my system. They may well be the same as on yours, they likely won't (as I've made some new commands etc for the bit torrent device).

I'm not trying to re-implement any part of LinuxMCE, only extend the potential reach of the system into Java land, and allow new parts of the system to be developed by all those Java programmers out there.

J2ME SDKYou need to have some j2me development kit installed to compile jdce-me and the example J2ME device. I use the sub WTK2.5.2 (from Sun). The compilation tool I've used (antenna), seems to support most of the others automatically, however you do need to set a property (wtk.home) in the build files (core, me, ExampleDevice) to reflect your installation.

AndroidAfter a, very, brief look into the android sdk I believe that all the classes I have used are within the standard android library, apart from the odd apache commons class I have used. I haven't tested this, I'm not an android dev, however I will be more than happy to make amendments to support this on android.

I'll have to dig a little deeper into the documentation and the extant Java code (which appears to access the database directly instead of wrapping the C interface, which could simply some things, but make accessing shared memory more difficult).

I thought I might be able to take a quick look at the build by running "apt-get install pluto-dcegen pluto-sql2cpp subversion build-essential libmysqld-dev" on my Ubuntu Studio 12.04, though it seems unable to locate the Pluto packages. Does that mean I need to add "https://pluto.coe.fsu.edu/svn/common/" to my list of repositories?

Or do I simply need to wipe my machine and load LinuxMCE as the only way to obtain a sense of what's involved?

I thought I might be able to take a quick look at the build by running "apt-get install pluto-dcegen pluto-sql2cpp subversion build-essential libmysqld-dev" on my Ubuntu Studio 12.04, though it seems unable to locate the Pluto packages. Does that mean I need to add "https://pluto.coe.fsu.edu/svn/common/" to my list of repositories?

Or do I simply need to wipe my machine and load LinuxMCE as the only way to obtain a sense of what's involved?

this is a different repo, ill post in dev so that someone who knows exactly what you need to add cant comment.

Yeah, Plugins share address space with the DCERouter. Plugins and the DCERouter are all written in C++, as are a good number of the core devices.

In order to do any LinuxMCE development, you really need to get a working system up and running first, and then follow "Developing a DCE Device" in the wiki, to get things installed and ready for actual development.

As far as the Java DCE implementation is concerned, I have not used it, but I am assuming that it was to be an implementation of our DCE class, here:

I'd like to add the capabilities/devices that I would like to use in my own home, and I'd like to be able to proactively contribute, instead of just add to the list of desired features and assume someone else will do them. I have several years experience as a system engineer/architect on large scale surveillance and security systems that have some particular high end features I'd like to incorporate into my own home security. I also want to provide high end HA features to specific situations that others likely would want too. My C++ skills are at the novice level and quite dated. My Java knowledge is also dated, but was at the intermediate level 10 years ago, so I'm assuming code contributions from me are most realistic in Java (unless minor tweaks to existing C++ would do the trick).

For example, some of the high end HA features I'm thinking of include;

HA1 - 'sunrise' alarm clock, which slowly raises the dimmer to full over a course of 20 minutes, then playing a sound file (ocean, waterfall, etc), increasing volume from very low to normal level over the course of (say) 2 minutes.HA2 - control a ceiling fan by room temperature and occupancy or time. For example, we have many evenings with the windows open that start off warm but end up cool by morning. The idea would be to have the fan turn on when we come into the room when it's warmer than desired, and turning off when we leave, or in a bedtime scenario where motion detection becomes rather useless, turning off the fan when a shutoff temperature is reaching (for example, 72 degrees F).HA3 - Enable more specific HVAC zoning via Z-Wave thermostat and actuation of dampers, based on actual and/or expected occupancy (by set timeframes modified by family calendar). HA4 - Enable temperature leveling, which takes air from rooms/floors warmer than desired to rooms/floors that are cooler than desired. We have a very low energy passive solar house, so a couple of south side rooms are warmer than one North side bedroom. In many multistory homes, this same problem exists between upper and lower floors. Just running the large whole house HVAC fan would use much more energy than desired - micro ducts with a small efficient fan would do the trick. This would take precedent in a goal-seeking manner over simple actuation of the HVAC.HA5 - open/close the insulated shades (or extend/retract deck awning) based on projected solar insolation from weather forecast information (NOAA, radar images, wind direction, etc) and balance that against the house desired temperature profiles and house thermal storage properties. This would be appropriate to non-solar homes as well.HA6- (long shot nice to have) voice recognition and feedback, in order to directly control devices or to trigger scenarios (e.g., "Set alarm for Julia for 6:45am", "all outside lights on", etc with a voice acknowledgement by the system). Palaver on Ubuntu is at the point where incorporation of this capability might be much closer to reality, at least in baby steps. Might be limited to smartphone initially.

Select security features would include;

S1- video analytics, to enable S1.1 -- PTZ camera tracking, which provides greater resolution of the person under observation and affords a wider coverage area S1.2 -- distinguish people from pets (or tree limbs blowing in the breeze) in a motion sensing situation S1.3 -- set boundaries where normal activity is ignored, but intrusion into particular areas is alarmed at specific times (or per scenarios)S2 - on screen PTZ controlS3 - two way audio for remote front door dialog (e.g., from phone when not home)

As you can tell, some of these are interrelated, such as the two way security audio (S3) and voice recognition/feedback for device/scenario actuation (HA6), for example. Some seem obviously implementable by 1-Wire (HVAC zoning damper control, temperature leveling fan control) while other are more suited to one of the established HA protocols (e.g., Z-Wave HVAC thermostat).

To be frank, I haven't fully settled on a specific open source HA application yet, so am in the trade space analysis mode currently. I just ordered an Aeotec USB controller and a Z-Wave dimmer switch, so expect Z-Wave to be one of the primary protocols I use, though would like to incorporate some existing X-10 switches and expect to incorporate 1-Wire (or something similar). The LinuxMCE collaboration with Ago is helpful in that regard.

The skills I have to offer;

- Novice and dated C++ (really only ever limited to occasional integration of C code from Java apps)- Intermediate and dated Java (and J2EE)- Advanced and very dated Ada (noted here for background purposes only)- Modest AI, neural network, and expert system knowledge- Security engineering and integration (on large scale systems)- Agile/scrum (on architecture efforts, have been alternate scrum master)- Using Eclipse on architecture (never tried to code or make a build in Eclipse, though)- Using Rational Jazz Suite and Software Architect- Enterprise architecture (from Capability planning, roadmapping, requirements management, traceability to services, etc, down to interface definition (XML schema/SOAP/WSDL/etc) to full fledged UML/SoaML/SysML (and to some extent DoDAF/UAF) on Rational Software Architect, to include reverse engineering of existing code to create UML diagramming (if I can get my head around building the current C++ codeset)

The projects/programs I've been engaged with include the International Space Station, X-35, many DoD C4ISR systems, surveillance, etc.

At 57 yo, I'm not a Spring chick when it comes to learning new libraries, development tools, etc, but can certainly support system architecture (planning roadmapping, depiction, documentation, versioning), testing, and user-oriented documentation at a minimum. If the Java DCE implementation was operational, I was thinking I might even incorporate some new devices.

As you can no doubt surmise, I'm rather energy/climate conscious, and hence one of my goals is to further improve the energy efficiency of my home. The platforms I expect to implement are very energy efficient, from my Atom-based notebook to some number of (perhaps) Raspberry PIs when additional targeted horsepower is needed (the higher end video analytics might be a challenge in that regard). I've been using Ubuntu at home for roughly 8 years now, so am somewhat Linux literate from a user perspective, though have been very platform independent as a developer/designer/architect.

Given the LinuxMCE vision, roadmap, codebase, and current contributor skillsets, do you see a potential fit for me here? If so, in what manner?

Given the LinuxMCE vision, roadmap, codebase, and current contributor skillsets, do you see a potential fit for me here?

Sure. Pick something you want done, and do it. If you have a question, come by the IRC channel #linuxmce-devel on Freenode, expect some beatings every now and then, and enjoy the mood, of not have a timeframe for completion. Things get completed when they are done.