Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Define mask in Event name

If you have a question or need help, this is the place to be.
Post Reply
gus2000
Posts: 2
Joined: Wed Mar 30, 2016 11:18 am

Define mask in Event name

Post by gus2000 »

I use an Apple remote that gives events like:
Up Key : HID.2587EE090B

The 09 value is variable between remotes, because it can be changed by a special remote function and serve as pairing.

Is there a way to define mask, so Eventghost will not look at this value.
Ex something like : HID.2587EEXX0B
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Define mask in Event name

Post by Pako »

Here's one possibility:
EventMask.png
Caution: The event with mask must have a different prefix (in the example HID#2).

Pako
You know flattr ? You can Image
m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Define mask in Event name

Post by m19brandon »

Pako, that is great. I never know suffix existed. :)
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Define mask in Event name

Post by kgschlosser »

ya know i just did something pretty cool with events also,

i am running 2 plugins and they exchange some data, but what i wanted is for en event to fire just the one and be able to do some tree stuff with it but at the same time have that same transport mechanism talk to the other plugin.

i just set up a thread to monitor the eg.EventString variable for the particular event.

idk i was bored, and it worked!!

K
If you like the work I have been doing then feel free to Image
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Define mask in Event name

Post by blackwind »

Make these changes to eg/Classes/EventGhostEvent.py (or wait for v0.5.0) and use "HID.2587EE??0B".
/bw
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Define mask in Event name

Post by Sem;colon »

blackwind wrote:Make these changes to eg/Classes/EventGhostEvent.py (or wait for v0.5.0) and use "HID.2587EE??0B".
Hi Blackwind,
that's definitely something that's missing in EventGhost.
But I also have concerns, I don't know how fast eg.eventTable.get is to be honest, but comparing each event with every single item of the eventTable sounds a bit slow to me - is it still as fast as before?
(I'm not at home this week and can't test it)
If you like my work, Image me a drink :wink:
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Define mask in Event name

Post by blackwind »

get() needs to iterate through each item as well to find the match. Performance is actually better than it was previously because it's no longer "getting" six times. Just be wary of using a lot of wildcards in your config, as fnmatchcase() isn't especially fast.
/bw
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Define mask in Event name

Post by kgschlosser »

since you all pointed out exactly where the event stuff was, and since i really didn't have to go poking around for it..


I decided to do this and to be rid of all of that crazy key +'.*' stuff

and make it all simple like and actually have it so that every event level can be triggered by a wildcard

and i understand as to why it was orignally done skipping levels

but, i know not to wile card a wild carded item unless i explicitly account for it's ability to get triggered when the event might not be for it.

but that's really easy to handle to cut down on making a billion tree items when 1 would suffice for a device that has 150 events for it.

here is the code if anyone is interedted, it's in the eg/classes/EventGhostEvent.py file.


just after here

Code: Select all

eg.event = self
eg.eventString = eventString
eg.EventString = eventString 
and just before here

Code: Select all

activeHandlers = set()
for eventHandler in eventHandlerList:
    obj = eventHandler
all the code between those can be replaced with

Code: Select all

get = eg.eventTable.get
eventHandlerList = get(eventString, [])
for i in range(len(eventString.split('.'))):
    eventHandlerList += get('.'.join(eventString.split('.')[:-i])+'.*', [])
idk, that little piece there just looks good

K
If you like the work I have been doing then feel free to Image
gus2000
Posts: 2
Joined: Wed Mar 30, 2016 11:18 am

Re: Define mask in Event name

Post by gus2000 »

Thanks to all for these replies.
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Define mask in Event name

Post by Sem;colon »

Hi kgschlosser,
I'm sorry, I didn't get your explanation, can you give an example about what should work better with your code compared to the one from blackwind?
If you like my work, Image me a drink :wink:
Post Reply