|
JP1 Remotes
|
View previous topic :: View next topic |
Author |
Message |
The Robman Site Owner
Joined: 01 Aug 2003 Posts: 21234 Location: Chicago, IL |
Posted: Tue May 17, 2016 5:04 pm Post subject: |
|
|
How versatile is IRP in documenting protocols that basically have IF statements in them? In other words, if a protocol sends one type of signal for OBCs in the range 0-127 and another for OBCs in the range 128-255, does IRP support that?
Obviously, many of our executors do that sort of thing, but many of them are "combo" executors which means that, if you were to learn the signals, they would report different protocols and/or device codes. _________________ Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help! |
|
Back to top |
|
|
Barf Expert
Joined: 24 Oct 2008 Posts: 1414 Location: Munich, Germany |
Posted: Wed May 18, 2016 1:53 am Post subject: |
|
|
You are right. Probably some extension of IRP is needed for this. But this can be done. For example, I wrote this back in 2011.
A possible syntax might be something like this, for a three protocol combo, basically using the syntax of the ternary ?: operator as in C and derived languages, like Java:
Code: |
mode == 0 ? ( /* IRP of first version */ ) \
: mode == 1 ? (/* IRP of second version */ \
: (/* IRP of third version */)
|
|
|
Back to top |
|
|
mathdon Expert
Joined: 22 Jul 2008 Posts: 4523 Location: Cambridge, UK |
Posted: Wed May 18, 2016 12:48 pm Post subject: |
|
|
As I have mentioned elsewhere, I have developed a program that converts MAXQ executor code into IRP notation. This brought to light two requirements that standard IRP notation does not handle. One is the If .. Then .. Else construction that Rob has raised, the other is the use of arrays, where one or two bits of a variable byte form an index into the array formed by the fixed bytes. I handled these in an informal way that is intended to be reasonably self-explanatory to a human reader. Here, as a simple example, is the output for the Sony Combo protocol:
Code: | Sony Combo (12/15/20): PID=0027.new
4 fixed bytes: bit-reversed A B C D
2 variable bytes: bit-reversed X Y
If X:1:7=0
Preamble:
N1=A[Y:-2:5]
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,^45000u)3+ // when Y=0xxxxxxx
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:5,N1:8,^45000u)3+ // when Y=1xxxxxxx
If X:1:7=1
{40.0k,600}<1,-1|2,-1>(4,-1,X:7,Y:8,^45000u)3+ |
The preamble is a pre-processor that in the general case may itself contain conditional statements. This gives three levels of conditionals, an outer one before any required preamble, conditionals within any preambles, and finally an inner one after the preamble. There may be executors that even this structure does not cover, as my program handles most, but not all, known MAXQ executors.
I would be interested in seeing an extension of IRP notation that could cover these requirements in a way that is machine-processable while retaining reasonable readability for human readers. Over to you, Barf? _________________ Graham |
|
Back to top |
|
|
Barf Expert
Joined: 24 Oct 2008 Posts: 1414 Location: Munich, Germany |
Posted: Thu May 19, 2016 2:38 pm Post subject: |
|
|
I am not quite sure what your array notation means, but, with a few guesses, some not introduced notation, and a few assumptions swept under the table, how about this (line breaks introduced for readability):
Code: |
{40.0k,600}<1,-1|2,-1>(
X:1:7 ? (4,-1,X:7,Y:8,^45000u)
: (y:1:7 ? (4,-1,X:7,Y:5,N1:8,^45000u)
: (4,-1,X:7,Y:5,^45000u)
)
)3+
{A=fixed:-8:24, B=fixed:-8:16, C=fixed:-8:8, D=fixed:-8,
X=variable:-8:8, Y=variable:-8,
N1 = Y:-2:5==0 ? A
: Y:-2:5==1 ? B
: Y:-2:5==2 ? C
: Y:-2:5==3 ? D }
|
Basically, it is a matter of allowing the conditional operator af a few places. |
|
Back to top |
|
|
|
|
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
|