Author Topic: Java DCE Implementation  (Read 12860 times)

david_a_dawson

  • Veteran
  • ***
  • Posts: 79
    • View Profile
Java DCE Implementation
« on: January 31, 2010, 01:42:39 am »
Hello linux mce peeps.

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.

svn co https://javadce.svn.sourceforge.net/svnroot/javadce/trunk jdce

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.

Have fun, lemme know if any one is interested.

David.

Bugs
Bug reports go to me, not to the LinuxMCE trac; you can put them on sourceforge (https://sourceforge.net/projects/javadce), if you like.

J2ME SDK
You 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.

Android
After 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.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: Java DCE Implementation
« Reply #1 on: January 31, 2010, 10:38:06 pm »
Awesome.

Will give you what feedback I can.

Good job!
I never quit... I just ping out.

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Java DCE Implementation
« Reply #2 on: January 31, 2010, 10:49:00 pm »
Hello David,

thanks for your contribution!!

best regards,
Hari
rock your home - http://www.agocontrol.com home automation

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Java DCE Implementation
« Reply #3 on: February 04, 2010, 09:55:28 am »
Hi David,

Fantastic to see this work underway! Thanks for getting involved.

All the best


Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java DCE Implementation
« Reply #4 on: May 23, 2010, 03:51:13 am »
Is anyone using this?

-Thom

skyemoor

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Java DCE Implementation
« Reply #5 on: October 19, 2013, 03:50:33 pm »
Is anyone using this, or is there another Java DCE wrapper/interface?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java DCE Implementation
« Reply #6 on: October 19, 2013, 06:39:51 pm »
Not to my knowledge. If you want to pick this up and complete it, have at it.

-Thom

skyemoor

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Java DCE Implementation
« Reply #7 on: October 19, 2013, 09:54:45 pm »
I haven't coded in about 10 years, so will have to give serious thought and assessment before committing

In an initial look at the documentation, I see;

"Plug-ins have the ability to get pointers to the in-memory instance of the other plug-ins so they can share memory"

Does this mean C shared memory? My C experience is very limited (went from Ada software engineering to Java development, design, and architecture now doing primarily Enterprise Architecture), so accessing C shared memory is one obstacle to my outdated coding abilities.

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).

« Last Edit: October 19, 2013, 09:59:13 pm by skyemoor »

skyemoor

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Java DCE Implementation
« Reply #8 on: October 19, 2013, 10:18:02 pm »
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?

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Java DCE Implementation
« Reply #9 on: October 20, 2013, 02:10:12 am »
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.

irc is #linuxmce-devel
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java DCE Implementation
« Reply #10 on: October 20, 2013, 02:18:11 am »
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:

http://svn.linuxmce.org/svn/trunk/src/DCE

What are you ultimately wanting to do ?

-Thom

skyemoor

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Java DCE Implementation
« Reply #11 on: October 20, 2013, 01:52:53 pm »

What are you ultimately wanting to do ?

-Thom

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 control
S3 - 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?
« Last Edit: October 20, 2013, 03:24:53 pm by skyemoor »

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Java DCE Implementation
« Reply #12 on: October 20, 2013, 03:43:26 pm »
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.

skyemoor

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Java DCE Implementation
« Reply #13 on: October 21, 2013, 03:21:37 am »
I'm trying to follow the installation instructions at http://wiki.linuxmce.org/index.php/Installing_1204

- Install Kubuntu 12.04

I've downloaded this over 4 hours (WiMAX link). Next it says;

- Install Precise Pangolin desktop and update it.

Which starts downloading the current version of Kubuntu 12.04. I'm confused - what version should I be downloading or are there multiple versions I need to be made aware of and tracking?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java DCE Implementation
« Reply #14 on: October 21, 2013, 04:41:34 pm »
Yes. You want to download and install the Kubuntu 12.04 LTS image.

-Thom