Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve image filename from within OnObjectCreated event #18

Open
gememe opened this issue Jul 24, 2021 · 1 comment
Open

How to retrieve image filename from within OnObjectCreated event #18

gememe opened this issue Jul 24, 2021 · 1 comment

Comments

@gememe
Copy link

gememe commented Jul 24, 2021

The class EOSEventHandlers provides an OnObjectCreated event, which is triggered when the camera is done writing a captured image.

virtual void OnObjectCreated(const EOSEvent *evt, uint8_t* buf) = 0;

The event itself triggers fine, but how do I retrieve the filename of the written image? The buf doesn't seem to be a simple char* as I first thought.

The EOSEventMonitor example contains a custom parser made to extract a filename from EOS 'Object Created' event, as a source comment states. Running this example does indeed result in the filename being retrieved. Unfortunately, I don't see how I could integrate this code into my code.

If anyone could shed light on how this is done or point me in the right direction, I would greatly appreciate it. Thanks!

@gememe
Copy link
Author

gememe commented Jul 26, 2021

Alright, I did some more tinkering and found a solution of sorts. Just in case somebody else is looking how to do this:

I replaced the declaration of OnObjectCreated in eoseventparser.h with

virtual void OnObjectCreated(const EOSEvent *evt, const char* filename) = 0;

and modified eoseventparser.cpp as follows:

if (eosEvent.eventCode == EOS_EC_ObjectCreated) {
	/* lines removed:
	uint8_t* pbuf = valueParser.GetBuffer();
	pHandler->OnObjectCreated(&eosEvent, pbuf);
	*/
	// Lines added:
	*pp -= 8;
	pHandler->OnObjectCreated(&eosEvent, (char*)(*pp+0x20));
	*pp += 8;
}

This seems to work... somehow. Clearly, I'm not a C++ guy. It would be great if someone more qualified could look this over. Until then, use at your own risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant