GWSOFT.co.uk  

Site by Graham Wharton 
November 21st 2008 07:13:48 PM 



NOTE : This project is not currently in development and is totally unsupported. These pages are here for information only.

setMessageTarget

Declaration

extern "C" status_t setMessageTarget(BLooper* mtarget);

Description

This function is entirely optional. This function accepts a pointer to a BLooper object. This object should be used to pass any messages back to the host application. The function returns a status_t error code to indicate the success of the operation. Any of the status_t error codes can be used, but it is suggested that you stick to using B_NO_ERROR for success and B_ERROR for failure.

There are currently two messages which can be sent to the message target.

const int32 MSG_PLUGINDEBUG = 0x01012000;

This message should be sent with two Strings attached to the message. The first a string with the name of "plugname" should contain the name of the plugin. The second string should have the name "debugmsg" and contain a debug string. Host applications who call setMessageTarget and then receive this string should output it using their normal debug method, i.e to cerr, or to a log file etc.

const int32 MSG_UPDATEBAR = 0x01012001;

This message should be sent with a single Float attatched which containes a number of bytes. If the host app calls setMessageTarget then the plugin may send these messages to indicate the progress of an image download. It should be sent each time a block of data is received from the camera, and the value of the Float should be the number of bytes received. If these messages are not sent to the host during an image download, then the host software should still work, but will not be aware of the progress of the downloads.

Note: only send these messages of a valid target has been sent using this function.

Example Implementation

status_t setMessageTarget(BLooper* mtarget) { msgtarget = mtarget; return(B_NO_ERROR); } void senddebugmessage(char* message) { if (msgtarget != NULL) { BMessage *msg; msg = new BMessage(MSG_PLUGINDEBUG); msg->AddString("debugmsg", message); msg->AddString("plugname", "libbdcp_kodakdc210"); msgtarget->PostMessage(msg); delete msg; } } //See the download image routine for an example of sending the progress //messages
BDCP Developers Home Page