Please login or register.

Login with username, password and session length

Author Topic: Do I understand X10 programming properly?  (Read 11928 times)

Deemar

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 116
Do I understand X10 programming properly?
« on: May 03, 2011, 03:00:28 PM »

I want to write some X10 applications so I'm wondering if this is the exhaustive list for X10 API - http://www.agaveblue.org/projects/x10/docs/. Is there any more? There's a Java API too right? Any more?

Am I correct in thinking that you just initialize the device, then send commands and listen for replies? Sounds pretty simple, then I can create a front end to sit on top of it. Something touch screen / phone friendly maybe.
Logged

hawk1

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 625
Re: Do I understand X10 programming properly?
« Reply #1 on: May 03, 2011, 04:30:52 PM »

I don't know about all that.  But I do know that I have the mochad driver installed on Ultimate Edition Linux and it is working, but I have no idea how to program to make a front end for it.  Or a gui.   Any help would be appreciated.
Logged
koopr@sstelco.com, I don't know what I'm doin but I'm havin fun doin it!

pconroy

  • Hero Member
  • *****
  • Helpful Post Rating: 9
  • Posts: 294
Re: Do I understand X10 programming properly?
« Reply #2 on: May 03, 2011, 10:32:29 PM »

I want to write some X10 applications so I'm wondering if this is the exhaustive list for X10 API - http://www.agaveblue.org/projects/x10/docs/. Is there any more? There's a Java API too right? Any more?

Am I correct in thinking that you just initialize the device, then send commands and listen for replies? Sounds pretty simple, then I can create a front end to sit on top of it. Something touch screen / phone friendly maybe.

It depends on the device but yeah - that's essentially it.
You send it a command and then you wait for a reply.

The old CM11A uses a RS232 serial port.  Serial port IO from Java isn't hard, but it requires extra steps.
The newer CM15 is a USB device.
Again, you'll need Java libs specific to your OS to access the USB port.

X10 doesn't support Java or Linux.
X10 supports Windows and their native interface.

Don't let that deter you - plenty of people have connected their CM15As to Java.
Just be advised that you're on your own - don't expect help from X10.
Logged

mmauka

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 41
Re: Do I understand X10 programming properly?
« Reply #3 on: May 04, 2011, 12:20:46 AM »

Sounds pretty simple, then I can create a front end to sit on top of it. Something touch screen / phone friendly maybe.

If you are running heyu, there are iPhone and Android front-end applications. I do not have an iPhone or Android device so have not used these programs.

http://forums.x10.com/index.php?topic=21811.0
http://forums.x10.com/index.php?topic=22024.0
Logged

Deemar

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 116
Re: Do I understand X10 programming properly?
« Reply #4 on: May 04, 2011, 02:49:57 PM »

So it's not supposed to work in Linux? Is Java the only API they have available besides the C# which only works for Microsoft?

I do have Heyu installed but I wanted to develop my own start to finish in case I decide to incorporate the project at a later date. Maybe I could just build a front end which sends command line arguments to Heyu? That would for sure be easier.
Logged

mmauka

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 41
Re: Do I understand X10 programming properly?
« Reply #5 on: May 04, 2011, 04:51:27 PM »

So it's not supposed to work in Linux? Is Java the only API they have
available besides the C# which only works for Microsoft?

I do not know anything the X10 SDK for Java or Windows. I wrote mochad so I can
tell you more about it.

mochad is a TCP gateway for a CM15A, CM15Pro, or CM19A. It handles the low
level USB I/O and translates the binary packets into human readable text. To
turn a light on, an application must open a TCP socket and write a command to
the socket similar to "pl b3 on". To receive sensor input (motion/door/window
sensors), an application must read lines from the socket. This means
applications can be written in any language and run on any platform with a
network stack. mochad does not have any built-in security so should not be
exposed to the Internet. I use https to access my home web server which in turn
talks to mochad. For more details see the following.

http://sourceforge.net/apps/mediawiki/mochad/index.php?title=Main_Page

I do have Heyu installed but I wanted to develop my own start to finish in
case I decide to incorporate the project at a later date.

Maybe I could just build a front end which sends command line arguments
to Heyu? That would for sure be easier.

Heyu has a socket server feature so the front-end could send commands to Heyu
via TCP. I think this is how the Melloware iPhone and Android applications can
use Heyu as a back-end X10 controller. Google for "heyu socket". I do not have
a CM11A so have never used Heyu.

Heyu supports many devices but does not support USB controllers such as the
CM19A and CM15A.

mochad supports the CM19A and CM15A but does not support other devices.
Logged

Deemar

  • Sr. Member
  • ****
  • Helpful Post Rating: 2
  • Posts: 116
Re: Do I understand X10 programming properly?
« Reply #6 on: May 04, 2011, 05:09:33 PM »

Oh. So essentially you wrote your own input/output driver for the device.
Logged

mmauka

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 41
Re: Do I understand X10 programming properly?
« Reply #7 on: May 04, 2011, 11:08:37 PM »

Yes, mochad is a device driver with a TCP API.
Logged

pconroy

  • Hero Member
  • *****
  • Helpful Post Rating: 9
  • Posts: 294
Re: Do I understand X10 programming properly?
« Reply #8 on: May 06, 2011, 10:29:51 PM »

Oh. So essentially you wrote your own input/output driver for the device.


The CM11A is a serial port device - I read from it and write to it using standard UN*X calls from C and C++.  If I'm writing Java, I use a java-serial port library to give me the access to read() and write().

The CM15A is a USB device.  For C/C++ there are libraries that simplify the reading and writing to a USB device.  Same for Java.

So - no, I don't think anyone's written a driver, in the sense that I think of one. :)
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.