X-Git-Url: http://git.maemo.org/git/?p=jamendo;a=blobdiff_plain;f=branches%2Fnota-show-app%2Fsrc%2Fpdu.h;fp=branches%2Fnota-show-app%2Fsrc%2Fpdu.h;h=9c7cb16d69bf2f8c402e833dfde5a0a31421a93f;hp=0000000000000000000000000000000000000000;hb=71eece00473c745dbe74c7dd9abd6a5fa52ea3ab;hpb=496d310181c50d216bf2f44e9a970a791aa2aba0 diff --git a/branches/nota-show-app/src/pdu.h b/branches/nota-show-app/src/pdu.h new file mode 100644 index 0000000..9c7cb16 --- /dev/null +++ b/branches/nota-show-app/src/pdu.h @@ -0,0 +1,47 @@ +#ifndef PDU_H +#define PDU_H + +#include "notaio.h" +#include + +#define DEFAULT_SID 42 + +enum MessageTypes { + PUT_IMAGE = 's', + GET_IMAGE = 'g', + FACE_FOUND = 'f', + DISCONNECT = 'd', + QUIT = 'q' +}; + +typedef struct _ServiceMessage { + uns8 sigid_length; + uns8 sigid[2]; + uns8 argtype; + uns16 arglen; + char argdata[0]; +} ServiceMessage; + +#define SERVICE_MESSAGE_HEADER_LEN (sizeof(struct _ServiceMessage)) + +typedef struct { + volatile int *run_check; + void (*log)(const char*); + void (*put_image)(unsigned char* img_buf, int img_size); + unsigned char* (*get_image)(int* img_size); + void (*disconnect)(int socket); + void (*quit)(int socket); + void (*face_found)(int x,int y,int r); + +} ServiceCallbacks; + + +ServiceMessage* pack_pdu(int sigid, uns8* payload, int payload_len, int* pdu_len); + +HErrorCode read_smsg(HSSockID* socket, HSReceiveMode mode, ServiceCallbacks* cb); + +#define LOG(str) { cb->log(str); } +#define LOG1(fmt,arg) { char str[256]; snprintf(str,255,fmt,arg); cb->log(str); } +#define LOG2(fmt,arg1,arg2) { char str[256]; snprintf(str,255,fmt,arg1,arg2); cb->log(str); } + +#endif