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.
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.
Sending events from external app
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Sending events from external app
Hi,
I have my own software (C++) that I use to control outdoor/indoor lights in my house according to sunrise/sunset calculations. I support radio controlled devices using USB-UIRT and RF transmitters for USB.
I was thinking if I should interface with EventGhost and send those trigger events when its time to turn on/off lights.
What would be the best way?
a) Have a plug-in that includes my logic
b) Leave my app as is and interface with eg
Best regards, Walter
I have my own software (C++) that I use to control outdoor/indoor lights in my house according to sunrise/sunset calculations. I support radio controlled devices using USB-UIRT and RF transmitters for USB.
I was thinking if I should interface with EventGhost and send those trigger events when its time to turn on/off lights.
What would be the best way?
a) Have a plug-in that includes my logic
b) Leave my app as is and interface with eg
Best regards, Walter
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
The simplest way would be to just call EG with the -e option from your external application:
http://www.eventghost.org/wiki/Command-line_reference
http://www.eventghost.org/wiki/Command-line_reference
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
OK, thanks, sounds fine.
So basically I would create event names and macros inside eg to control my devices. When the event happens, the macro executes (turns on/off my lights).
Is there now a way for me to read the defined event names in eg thrue an api?
(I would like to build a collection/array within my app that holds all defined event names related to the light control function in my app)
Do you, in that case, have a sample for a call in c++ for retrieving the event names?
Best regards, Walter
So basically I would create event names and macros inside eg to control my devices. When the event happens, the macro executes (turns on/off my lights).
Is there now a way for me to read the defined event names in eg thrue an api?
(I would like to build a collection/array within my app that holds all defined event names related to the light control function in my app)
Do you, in that case, have a sample for a call in c++ for retrieving the event names?
Best regards, Walter
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
If you want to control your app from EG, you would need some kind of IPC interface inside your app. For example you could build a small command line tool, that sends parameters to your running app (through pipes, TCP/IP, SendMessage, COM, whatever). The remaining part can be done through scripting inside EG with Python:
http://www.eventghost.org/wiki/Scripting
Or you could split your app into one or more DLLs, that provide a basis of a plugin. Then you can call the functions inside through Python's ctypes module. The USB-UIRT, TechnoTrend, Tira, Streamzap and IgorPlug-USB plugins are examples of such kind of plugins.
Since EG already has an USB-UIRT plugin, you only need to build something for your RF device, I guess.
http://www.eventghost.org/wiki/Scripting
Or you could split your app into one or more DLLs, that provide a basis of a plugin. Then you can call the functions inside through Python's ctypes module. The USB-UIRT, TechnoTrend, Tira, Streamzap and IgorPlug-USB plugins are examples of such kind of plugins.
Since EG already has an USB-UIRT plugin, you only need to build something for your RF device, I guess.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
I understand what you say but I think we misunderstood each other.
I do not want to control my app from eg. I only want to send events and for this purpose the -e or -n option will be fine.
The only thing I wished to do in addition was to be able to read defined events in eg. Then I could easily "tick and link" those that applies in my app. The other way would be to type in the eg event names in my app setting as well (but why re-typing if I could retrieve the information from eg directly?)
Also the RF device will work with eg because I just saw there is now a plugin available for it
BTW do I get an ACK from eg when I send an event with the -e option?
Best regards, Walter
I do not want to control my app from eg. I only want to send events and for this purpose the -e or -n option will be fine.
The only thing I wished to do in addition was to be able to read defined events in eg. Then I could easily "tick and link" those that applies in my app. The other way would be to type in the eg event names in my app setting as well (but why re-typing if I could retrieve the information from eg directly?)
Also the RF device will work with eg because I just saw there is now a plugin available for it
BTW do I get an ACK from eg when I send an event with the -e option?
Best regards, Walter
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
I haven't understood what you want to achieve. You are free to use any event name you want with the -e option and you assign this event name to a macro. What else would you need to "read"? You can also assign additional data with the event, that we call "payload data". So you can make an event like:krambriw wrote: The only thing I wished to do in addition was to be able to read defined events in eg.
-e myevent 1234
And you will get the event "myevent" with the additional data "1234" that you can evaluate thropugh the eg.event.payload variable.
2. You won't get an ACK from the -e call.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Ahh, ok, I will try to explain better...
a) I define my events in eg like "Turn ON Lamp in Garage" and Turn OFF lamp in garage"
b) In my app I will define that when sun goes down, I will send the event "Turn ON Lamp in Garage" to eg using the -e option
During configuration of this, instead of having to type in the names of the events twice (once in eg and once in my app) I would like to read/retrieve/fetch the names from eg configuration data
Did you understand me now?
Reason is to make configuration easier/convinient/einfacher and to avoid mistyping/misspelling
Since I do not get an ACK on the -e option, can I check somehow that eg has executed my macro (looking up the eg logfile or similar)?
Best regards, Walter
a) I define my events in eg like "Turn ON Lamp in Garage" and Turn OFF lamp in garage"
b) In my app I will define that when sun goes down, I will send the event "Turn ON Lamp in Garage" to eg using the -e option
During configuration of this, instead of having to type in the names of the events twice (once in eg and once in my app) I would like to read/retrieve/fetch the names from eg configuration data
Did you understand me now?
Reason is to make configuration easier/convinient/einfacher and to avoid mistyping/misspelling
Since I do not get an ACK on the -e option, can I check somehow that eg has executed my macro (looking up the eg logfile or similar)?
Best regards, Walter
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
No, such function does not exist and will unlikely ever be implemented. You can just drag&drop the new events from logger the first time they appear.
If you want an ACK, it's up to you, what you want to do. You can use SendMessage, write a file, call an app or whatever from EG to get an response.
If you want an ACK, it's up to you, what you want to do. You can use SendMessage, write a file, call an app or whatever from EG to get an response.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
So my app now sends events to eg 
Using the ShellExecute... from C++, works fine
Also over network with newest eg beta...
Would like to make a more professional solution using your ActiveX/COM
Do you have a little sample in C++ how to interface with eg using COM?
hr = CoCreateInstance....and so on
Best regards, Walter
Using the ShellExecute... from C++, works fine
Also over network with newest eg beta...
Would like to make a more professional solution using your ActiveX/COM
Do you have a little sample in C++ how to interface with eg using COM?
hr = CoCreateInstance....and so on
Best regards, Walter
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Sending events from external app
Never done this in C++. Take a look at the VBS examples and do your best to transfer them to C++.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!