JP1 Remotes Forum Index JP1 Remotes


FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

IR Device Library in XML format?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - General Forum
View previous topic :: View next topic  
Author Message
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Tue Apr 06, 2004 2:00 am    Post subject: IR Device Library in XML format? Reply with quote

Hi - I've recently begun working with IR in the context of using a networked IR
device (GlobalCache GC100 www.globalcache.com) to control home theatre setups.
The global cache is a 'dumb' device, having no built-in IR codes whatsoever, so
I'm left with the option of building up my own IR database. It seemed like a better
route than grabbing the Pronto CCF files for each device one at a time from the
Premise Home Control site, as recommended by the Global Cache folks (too
painful). Little did I know how many variations on the IR theme existed!

Anyway, I'm building up a Java class library that can generate IR codes for the various
protocols, and am creating device descriptions in an XML format. I have built up
protocol generators for the more common formats (Sony, NEC, Panasonic) from
information on Barry Gordon's site (excellent resource) but am interested in
expanding the device coverage if possible. Ideally additional protocol descriptions
would be available in a simple description file, similar to Barry Gordon's 'IRP' format.

Is there a obvious straighforward path for me to convert some of the protocol algorithm
information from this site into a more 'IRP'-like format? (I don't see a master list
of protocols and their parameters at first glance) Figured I'd ask the experts before
exploring further!

Below is a quick snippet of my (very early) XML device description. I'm sure it
will be changing as things mature...

----------------------------------------------------------------------------------------------

<?xml version="1.0"?>

<!-- XML device description for IR control of generic Sony TV device -->

<IRDevice>

<Manufacturer>Sony</Manufacturer>
<DeviceType>TV</DeviceType>
<Model>Generic</Model>
<Protocol>Sony12</Protocol>

<!-- List of supported device/function codes. Some devices use multiple -->
<!-- device codes, so the device code is supplied for each key -->
<!-- Codes use attributes vs elements for conciseness (1 line per entry) -->

<KeyCodeList>

<KeyCode name="1" dev="1" func="0" />
<KeyCode name="2" dev="1" func="1" />
<KeyCode name="3" dev="1" func="2" />
<KeyCode name="4" dev="1" func="3" />
<KeyCode name="5" dev="1" func="4" />
<KeyCode name="6" dev="1" func="5" />
<KeyCode name="7" dev="1" func="6" />
<KeyCode name="8" dev="1" func="7" />
<KeyCode name="9" dev="1" func="8" />
<KeyCode name="0" dev="1" func="9" />

<KeyCode name="Enter" dev="1" func="11" />

<KeyCode name="Chan Guide" dev="1" func="14" />
<KeyCode name="Clear" dev="1" func="15" />
<KeyCode name="Channel+" dev="1" func="16" />
<KeyCode name="Channel-" dev="1" func="17" />
<KeyCode name="Volume+" dev="1" func="18" />
<KeyCode name="Volume-" dev="1" func="19" />
<KeyCode name="Mute" dev="1" func="20" toggle="true" />
<KeyCode name="Power" dev="1" func="21" toggle="true" />

</KeyCodeList>

</IRDevice>
Back to top
View user's profile Send private message
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Tue Apr 06, 2004 9:11 am    Post subject: Re: IR Device Library in XML format? Reply with quote

onewell wrote:

Anyway, I'm building up a Java class library that can generate IR codes for the various
protocols,


...

onewell wrote:

Is there a obvious straighforward path for me to convert some of the protocol algorithm
information from this site into a more 'IRP'-like format?


My makeHex program uses a .irp format that is just a slight improvement on Barry's .irp format.

The C++ source code and all the .irp files for MakeHex are posted (I don't have the URL handy just now).

The .IRP files with MakeHex cover most of the common protocols discussed here, and match the teminology used here more closely than Barry's files do. So one good option for you would be to use those .IRP files and write some JAVA code to read that form of .IRP and generate the desired output. You can use the MakeHex source code as a starting point for both aspects of that.

A better (but initially harder) method would be to use our new IRP notation. It is more concise and more powerful, and covers a few obscure protocols that can't be specified in older .IRP notation.

The new IRP notation is specified by the thread in the JP1-KM group where Jon and I discussed it.

I haven't yet written a Java class to read that IRP notation and translate it into a data structure that could be used by later code for generating or recognizing the protocol. That was my intent when I invented the new notation. If you decide to write that class, I hope you'll share (I can provide some support and assistance).

One of my plans is to add that IRP notation to each entry in RM's protocols.ini file. Jon and I have all that data scattered around, so it wouldn't be too hard for either of us to put it into protocols.ini.

RM is coded in Java, so that if there were a Java parser for the new IRP notation, and the IRP entries were in protocols.ini, it would be easy to take a bunch of code from RM and end up with a Java app that uses all our RM formatted upgrades (plus RM can import most KM formatted upgrades) and generate them complete with function names in formats for other remotes (such as you described).

I think using new IRP notation and RM formatted upgrades is by far the best approach for what you are trying to do.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jon_armstrong
Expert


Joined: 03 Aug 2003
Posts: 1238
Location: R.I.P. 3/25/2005

                    
PostPosted: Tue Apr 06, 2004 1:35 pm    Post subject: Reply with quote

There is a spreadsheet that I put together in the old irp notation. It actually is in a format that can be used by GenIRDB (in most cases). If you download DecodeIR.dll and read the included documentation you will find that John has added some additional protocols in the new notation plus has many of the same protocols in the new notation.

I have also smashed together the text of a series of discussions between John and me on the new notation. It is a bit rough from an editorial perspective, but John explained ever thing pretty clearly and it may save some time. I also put together a similar Excel spreadsheet of the Protocols in the new irp format, but is also not quite ready for prime time. If either would help you, email me and I'll send them to you.

As John has mentioned, Barry's irp files reflect the thinking of about three years ago. Since then this group has continued to discover and decode many more IR protocols and has a deep understanding of them. This is out of necessity, because OFA remotes have 2 KB of EEPROM and can only learn ~25 commands in the 1KB allocated to learning.

However, if you understand the protocol then you can do an entire device/protocol upgrade in ~100 bytes and with the advanced tools can recover most of the learning space for additional device upgrades
_________________
-Jon
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Tue Apr 06, 2004 7:43 pm    Post subject: Reply with quote

Thanks for the info...sounds like the new 'irp' notation is the way to go.

Is there a version of a 'irp form compiler' that is suitable for adaptation to Java
(adding support for the new notation along the way) ? ( I looked for the MakeHex
source but couldn't find it anywhere on this site or remote central)

If not, I'll cook my own...(I'll share it when it's presentable). If you
have any thoughts on inputs/outputs to the black box, let me know.
I'll post my initial design ideas before I go too far, just to make sure
I'm not missing the point.

Is the thinking that, if properly coded, this Java parser would eventually find a home
in RM? (In that case maybe I'd better comment it!). l looked briefly at the RM code,
and it looked like a base 'Translator' class was extended by subclasses to provide
support for the various protocols. Presumably that would be unnecessary if the protocol notation was flexible enough to handle all the known protocols? Am I getting that right?

Jon - I'll take whatever you have on the new notation. I found the threads on Yahoo
and it looked like it was pretty well spec'd out, except I don't remember seeing
support for Barry's DEFINE capability. I'll send you my email momentarily...

Thanks again -

-Oliver
Back to top
View user's profile Send private message
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Tue Apr 06, 2004 8:36 pm    Post subject: Reply with quote

onewell wrote:

Is there a version of a 'irp form compiler' that is suitable for adaptation to Java


I'm not sure what you mean be "compiler" in this context. But anyway, the answer is "no". There is no software yet for the new irp notation.

onewell wrote:
I looked for the MakeHex
source but couldn't find it anywhere on this site or remote central)


I just looked too, and I couldn't find it posted anywhere. I'm sure I posted 4.01 sources at the same time as the binary, but ???

I have the sources on the computer I'll be at tomorrow. I'll try to remember to repost sources.

But MakeHex irp notation is much closer to Barry's irp notation than to the new notation.

onewell wrote:

If you
have any thoughts on inputs/outputs to the black box, let me know.


In some thread somewhere in JP1-KM I posted some of my ideas for the sort of object that an IRP parser should parse irp into. That was intended to support an IR signal recognizer that never got written, but the parsing of IRP notation into a convenient structure should be the same for an IR generator as for an IR recognozer.

If we can't find that and/or it isn't as much as I think I remember writing, I'll post more here.

onewell wrote:

I'll post my initial design ideas before I go too far, just to make sure
I'm not missing the point.


That will also help. I never know what will be insultingly obvious to someone else vs. what will be incomprehensible.

onewell wrote:

Is the thinking that, if properly coded, this Java parser would eventually find a home
in RM?


There is no JP1 need for an IRP parser in RM, but I'd like to see RM files made useful for Pronto and other remotes. The key step to that is something like MakeHex that uses the named functions from RM rather than blindly generating all functions. The only non trivial piece of work in creating that is puting an irp parser into RM.

onewell wrote:

l looked briefly at the RM code,
and it looked like a base 'Translator' class was extended by subclasses to provide
support for the various protocols. Presumably that would be unnecessary if the protocol notation was flexible enough to handle all the known protocols? Am I getting that right?


No. A JP1 remote has much less hardware resource than a Pronto or other universal that take that generalized data driven approach to most protocols. A JP1 remote is programmed with a strange mixture of code and data both leveraging the existing code and data in the ROM.

All those translators in RM are needed to properly generate the upgrade. The IRP notation can't reasonably be used in that process.

The key resource I want to share between RM and non JP1 use (benefiting both) are the user created files specifying the relationship between function names and protocol/device/subdevice/obc values. The EFC stuff and button stuff and most of the translator and hex command stuff would be there just for JP1 users and the irp stuff for non JP1 users.

We may want to spec some ability for the IRP notation to use the JP1 hex to suplement the device/subdevice/obc inputs. In a few strange protocols, quite a lot of processing is in those translators which would be easier for an irp string to take than to recreate.

If someone had the time, they could also use the IRP data in RM to create clean JP1 learned signals for people who don't want to use extenders but still want to max their remote's programming. I'm not sure anyone will ever be motivated to do that, but an irp parser in RM would get half way there.

onewell wrote:

Jon - I'll take whatever you have on the new notation. I found the threads on Yahoo
and it looked like it was pretty well spec'd out, except I don't remember seeing
support for Barry's DEFINE capability.


That ability isn't strictly needed, because the new notation allows arbitrarily complex subexpressions in the body of the IR form. However, a define ability would cetainly make the complex forms easier to read and write. I meant to give that more thought when the time came to write code, but I think we could simply allow letter=expression within the {} part of the notation and then use the letter in the body, arbitrarily (as the new MakeHex does) as a bitfield, a duration, or an ordinary number.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Tue Apr 06, 2004 11:27 pm    Post subject: Reply with quote

johnsfine wrote:
onewell wrote:

Is there a version of a 'irp form compiler' that is suitable for adaptation to Java


I'm not sure what you mean be "compiler" in this context. But anyway, the answer is "no". There is no software yet for the new irp notation.


I think I just mean 'parser' really, but the intent would be to generate an in-memory representation of the IRP form that could be used to generate IR bursts on-the-fly in a relatively efficient manner (like the regular expression compiler in Java)

johnsfine wrote:
onewell wrote:

Jon - I'll take whatever you have on the new notation. I found the threads on Yahoo
and it looked like it was pretty well spec'd out, except I don't remember seeing
support for Barry's DEFINE capability.


That ability isn't strictly needed, because the new notation allows arbitrarily complex subexpressions in the body of the IR form. However, a define ability would cetainly make the complex forms easier to read and write. I meant to give that more thought when the time came to write code, but I think we could simply allow letter=expression within the {} part of the notation and then use the letter in the body, arbitrarily (as the new MakeHex does) as a bitfield, a duration, or an ordinary number.


Ok, I'll add that in...

Thanks for the help!
Back to top
View user's profile Send private message
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Wed Apr 07, 2004 12:28 pm    Post subject: Reply with quote

I have a few comments on the data structures that I think IRP should parse into.

When I designed IRP notation, I intended that the parser be able to distinguish ordinary numbers from durations by context and thus I said all the processing of time unit quantities into microsecond quantities would happen at parse time, rather than execution time.

When I added a more general "define" ability to makehex, I discovered that it became arbitrarily complicated to distinguish durations from numbers inside subexpressions. I decided it was simpler to leave that (and multiplying by the unit size) to execution time. I think the same decision may be best for the new IRP parser.

That means we need a scalarValue class for the result of evaluating a scalar object. The scalarValue would contain the value itself, plus a flag for whether it is explicily in microseconds (vs. just being a number).

A scalar object has two important methods:
1) It can be evaluated (returning a scalarValue object)
2) You can pass it an inputContext object and an outputContext object and it will generate an IR signal.

An outputContext object accumulates an IR signal as it's generated. The parser doesn't create any outputContext objects. It just creates objects which know the interface of an outputContex. You can tell an output context to emit a duration (a positive or negative duration in microseconds) and you can tell it where a repeat begins (with minimum and max repeat count) and where it ends. A prontoHex outputContext may have extreme limits on repeating: The must be only one true repeat in the whole IR signal, it must have an unlimited max and it must end at the absolute end. Some other outputContext object may be more flexible. The caller's of the outputContext should try whatever the IRP notation tells them to try and let the outputContext abort if it can't handle it.

An inputContext holds the unit, the current bitSpec, the msb flag, the values of defines, and the interface to external inputs (such as device, subdevice and function in RM).

There are two fundamental kinds of scalar. A bitField and a scalarNumber. They do two totally different things when asked to generate IR. A scalarNumber evaluates itself and converts the result to microseconds (if it wasn't already) and passes that to the outputContext. A bitField evaluates itself and then sequences through the bits of that value (as specified by the msb flag) and passes each bit (and the ouput context) to the current bitSpec for processing.

There are many kinds of scalarNumber object. Those include simple numbers, simple duration numbers (in microseconds), symbol references, and various subexpression operations (such as a plus operation). All share the same method for generating IR but have different eval methods.

Many scalar objects include references to other scalar objects: a bitField contains references to three scalars; a plus operation contains references to two scalars; etc. The types can be mixed. In theory you could add a bitField to a duration etc.

The key data type would be a sequence. It contains:
1) Optionally a reference to a bitSpec
2) A min and Max repeat count (by default both are 1). Max needs some encoding for unlimited.
3) A sequence of refrences to objects that are able to generate IR. The two kinds of such objects are sequences and scalars.

When you generate IR for a sequence, first it checks whether it has a bitSpec. If so it makes a clone of the inputContex it was given and binds the original input context into the bitSpec and binds the bitSpec into the clone, then uses the clone. Otherwise it just uses the inputContext it was given. Then it just calls every item in the sequence to generate IR.

A bitSpec contains refrences to some power of two number of sequences. It also can have an inputContext temporarily bound to it, and it can buffer bits until it has enough to select a sequence. When called with a bit and an outputContext, it either just buffers the bit, or uses the accumulated bits to select a sequence them passes the input and output contexts to that sequence to generate IR.

A parser should be able to go through the IRP, delaying the decisions about whether each '(' represents a start of sequence or a start of subexpression, and other than that having an easy time converting the text to a big tree of sequence, bisSpec and scalar objects, plus some info for the inputContext object.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Wed Apr 07, 2004 4:28 pm    Post subject: Reply with quote

I finally posted those MakeHex sources at
http://john.fine.home.comcast.net/ir/source/MakeHexCpp.zip
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Wed Apr 07, 2004 10:04 pm    Post subject: Reply with quote

Thanks for the data structure comments and the MakeHex post...

I was just experimenting with 'javaCC' for parsing the IRP notation. Cool utility,
but it may be overkill for the limited IRP grammar - I'd rather have more readable
parser code than javaCC generates, and less of it. That bias may be just 'cause I'm
not very familiar with the tool though. Time to read up on tokenizer/parser lingo!

-Oliver
Back to top
View user's profile Send private message
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Thu Apr 08, 2004 7:20 am    Post subject: Reply with quote

I never heard of the javaCC tool, but I've worked with many tools for generating parsers. Generally I don't like them. Anyone who knows how to write a parser can write a smaller, faster, more readable, more maintainable parser directly without the tool.

In some sort of class on compiler writing, where you design the language syntax AFTER you select the parser writing tool, such tools can have a major advantage. They let someone who doesn't know how to write a parser write one.

More importantly they make certain syntax design decisions very hard to implement. That forces the student to adjust the syntax to be more easily parsed. Usually that means correcting syntax design mistakes that the student has made and results in a better final syntax than you'd get if the tool hadn't made the bad syntax hard to implement.

In the real world, a parser writer is usually handed a syntax spec with no choices to fix the syntax to fit the tool. In kludging the use of the tool to fit the syntax, you get an unmaintainable mess (believe me, I've been through that MANY times).

In the case of IRP, it may be too simple to be worth the tool. But it also has the intentional ambiguity between sequences and expressions, which I decided makes it cleaner for the user, but a little trickier for the coder of a direct parser. I'm not sure about javaCC, but most parser generation tools are totally blocked by that sort of ambiguity. ANTLR can handle it as a three level parsing process (insert a paren matching tree generation level above the lexer and below the real parser) but that really overkill for just IRP. Traditional automatic two level (lex and parse) designs can't do it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Mon Apr 12, 2004 7:13 pm    Post subject: Reply with quote

Hi John -

A couple of basic questions on the protocol format:

1. The Sony12 format is listed (in the protocol spreadsheed and DecodeIR
README) as:

{ 40k, 600 } <1,-1 | 2, -1>(4,-1,F:7,D:5,^45m)+

My experience with Sony devices is that the signal needs to be transmitted a
minimum of 2 times. Is that not true for all Sony devices? If so, should the
protcol description read:

{ 40k, 600 } <1,-1 | 2, -1>(4,-1,F:7,D:5,^45m)2+

2. (newbie question) I understand that D = device code, F = function code. A
number of the protocols have an 'S' field. Is that like an extended device
code? Is it always used when device codes are more than 8 bits?


BTW - Picked up a Pronto off Ebay to help solve any Pronto Hex mysteries I
might encounter. I also got a cheap OFA remote (URC-4330B03) from CVS
just so I can beam it's codes over to the pronto and examine the HEX if I
want.

-Oliver
Back to top
View user's profile Send private message
Mark Pierson
Expert


Joined: 03 Aug 2003
Posts: 3017
Location: Connecticut, USA

                    
PostPosted: Mon Apr 12, 2004 7:25 pm    Post subject: Reply with quote

onewell wrote:
A number of the protocols have an 'S' field. Is that like an extended device code?

It what we refer to in the JP1 world as a Sub-Device. Some protocols don't use any; some use more than 1. As for the details of each, I'll defer to the experts! Wink
_________________
Mark
Back to top
View user's profile Send private message Send e-mail Visit poster's website
johnsfine
Site Admin


Joined: 10 Aug 2003
Posts: 4766
Location: Bedford, MA

                    
PostPosted: Mon Apr 12, 2004 7:58 pm    Post subject: Reply with quote

onewell wrote:

My experience with Sony devices is that the signal needs to be transmitted a
minimum of 2 times. Is that not true for all Sony devices? If so, should the
protcol description read:

{ 40k, 600 } <1,-1 | 2, -1>(4,-1,F:7,D:5,^45m)2+


That's the sort of detail we would normally miss when reverse engineering a protocol. Sony is common enough I would expect to have noticed some issues if we got that wrong, but we might have.

onewell wrote:

2. (newbie question) I understand that D = device code, F = function code. A
number of the protocols have an 'S' field. Is that like an extended device
code? Is it always used when device codes are more than 8 bits?


It's a fairly arbitary decision when we reverse engineer a protocol where or whether we break it into device and subdevice. We haven't made any rule in IRP notation limiting device to 8 bits. But sometimes we adjust our boundaries to fit where UEI put combo-protocol boundaries, and those tend to be on 8-bit boundaries.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Mon May 03, 2004 1:00 am    Post subject: Reply with quote

Hi John -

FYI - I got diverted with other things for a while, but I now have a mostly functioning Java IRP parser. One thing I did do to make my life easier was to use '[' ']' instead of '(' ')'
for expressions (remove the ambiguity between expressions and IRStreams).
I wasn't too clear on why you intentionally designed it this way - feel free to clarify...


Right now the code can generate 'generic' IRBursts in units of clock frequency. I'm
planning on coding up a Pronto hex converter 'plug-in', and tidying up this week.
Hope to post the result at the end of the week for feedback.

-Oliver
Back to top
View user's profile Send private message
onewell



Joined: 06 Apr 2004
Posts: 8

                    
PostPosted: Thu May 20, 2004 5:22 pm    Post subject: Reply with quote

Hi -

I just posted a zip file with my first cut at a Java-based IR signal generator package. It's at:

www.mediarush.com/download.html

There is a README in the top directory of the unzipped archive. In a nutshell, the package has:

- An (intially tiny) set of device descriptions in XML format,
and a separate set of protocols using John Fine's IRP
notation (the latest version). The XML file format
allows the IR protocol parameters (device/function codes)
to be specified on a device-wide, function group-wide,
or indivual keyCode basis. Also the format is set up to
allow device files to be nested - more 'generic' versions
of devices can be used as 'Base Devices' for more
advanced versions of the device.

- Java IR device and protocol classes that work with the
above. The protocol parser class builds up an in-memory
represention of the protocol (a syntax tree, basically),
which can be used to generate IR signals on the fly.

- A couple of simple sample programs to interactively
generate Pronto Hex for a device, or alternatively
control it using a GlobalCache IR controller.

This package is probably not bug-free enough yet for general use, but I'm interested in feedback, general impressions, and ideas for efficiently populating the database with device files in the XML format (the
real trick!)

Cheers,

-Oliver
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - General Forum All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

Powered by phpBB © 2001, 2005 phpBB Group
Top 7 Advantages of Playing Online Slots The Evolution of Remote Control