1
General Discussion / Re: UDP Events
« on: February 21, 2014, 12:02:30 PM »
Hi James
Thanks for the help so far. I've had some fun over the last week or so teaching myself some basic Python & modifying the script you wrote. [As an aside, key driver for this is that the UDP packets that I'm receiving are the interpretations of the IR code that my network connected receiver is picking up... & due to the natural variability of IR, I've had to (with a bit of advice from the manufacturer of the IR receiver unit) write some code to allow for this variability & map back to what should be a consistent read of the IR pulses.]
Anyway... on to my question. The Python script is now returning the UDP packets reliably as payload {1} in a text format such as "ABCDCDCDBCDCDC" (representation of the IR code). What I ideally want to do now is the equivalent of an Excel vlookup - I want to match the payload returned to obtain the Global Cache command to send out over the network, & be able to do this for a bunch of possible valid different payload values. Ideally a logical statement along the lines - If (data field1 from any row in my table) matches (payload from Python script) then (return data field 2 from the same row in the table). I then want to be able to use (data field 2) as the value to send out to my GC iTach unit.
I had thought I could achieve this vlookup type functionality using Maps in the LCB - but having played around a bit I don't think they work in this way. Can I in fact use the Map/LCB functionality to do what I want - or do I need to get to grips with more Python coding (including importing values from table) to achieve my goal?
All good fun & interesting.
Simon
Thanks for the help so far. I've had some fun over the last week or so teaching myself some basic Python & modifying the script you wrote. [As an aside, key driver for this is that the UDP packets that I'm receiving are the interpretations of the IR code that my network connected receiver is picking up... & due to the natural variability of IR, I've had to (with a bit of advice from the manufacturer of the IR receiver unit) write some code to allow for this variability & map back to what should be a consistent read of the IR pulses.]
Anyway... on to my question. The Python script is now returning the UDP packets reliably as payload {1} in a text format such as "ABCDCDCDBCDCDC" (representation of the IR code). What I ideally want to do now is the equivalent of an Excel vlookup - I want to match the payload returned to obtain the Global Cache command to send out over the network, & be able to do this for a bunch of possible valid different payload values. Ideally a logical statement along the lines - If (data field1 from any row in my table) matches (payload from Python script) then (return data field 2 from the same row in the table). I then want to be able to use (data field 2) as the value to send out to my GC iTach unit.
I had thought I could achieve this vlookup type functionality using Maps in the LCB - but having played around a bit I don't think they work in this way. Can I in fact use the Map/LCB functionality to do what I want - or do I need to get to grips with more Python coding (including importing values from table) to achieve my goal?
All good fun & interesting.
Simon