// Minimal luna-service2 stand-in for host-side syntax checks. Mirrors the // signatures this project calls, so a typo or a wrong argument count is caught // without a webOS SDK. See ../glib.h. #pragma once #include #include typedef struct LSHandle LSHandle; typedef struct LSMessage LSMessage; typedef struct { int error_code; char* message; const char* file; int line; const char* func; void* padding; unsigned long magic; } LSError; typedef bool (*LSMethodFunction)(LSHandle* sh, LSMessage* msg, void* category_context); typedef bool (*LSFilterFunc)(LSHandle* sh, LSMessage* reply, void* ctx); typedef unsigned long LSMessageToken; typedef enum { LUNA_METHOD_FLAGS_NONE = 0, } LSMethodFlags; typedef struct { const char* name; LSMethodFunction function; LSMethodFlags flags; } LSMethod; typedef struct { const char* name; void* function; unsigned int flags; } LSSignal; typedef struct { const char* name; void* function; unsigned int flags; } LSProperty; void LSErrorInit(LSError* error); void LSErrorFree(LSError* error); bool LSRegister(const char* name, LSHandle** handle, LSError* error); bool LSUnregister(LSHandle* handle, LSError* error); bool LSRegisterCategory(LSHandle* handle, const char* category, LSMethod* methods, LSSignal* signals, LSProperty* properties, LSError* error); bool LSCategorySetData(LSHandle* handle, const char* category, void* user_data, LSError* error); bool LSGmainAttach(LSHandle* handle, GMainLoop* loop, LSError* error); const char* LSMessageGetPayload(LSMessage* message); bool LSMessageIsSubscription(LSMessage* message); bool LSMessageReply(LSHandle* sh, LSMessage* message, const char* reply, LSError* error); void LSMessageRef(LSMessage* message); void LSMessageUnref(LSMessage* message); bool LSSubscriptionAdd(LSHandle* sh, const char* key, LSMessage* message, LSError* error); bool LSSubscriptionReply(LSHandle* sh, const char* key, const char* payload, LSError* error); // Client-call API: this service acting as a caller of another service, not // just a callee. LSCall keeps calling `callback` for every reply (used for // subscribe:true); LSCallOneReply auto-cancels after the first one. bool LSCall(LSHandle* sh, const char* uri, const char* payload, LSFilterFunc callback, void* ctx, LSMessageToken* ret_token, LSError* error); bool LSCallOneReply(LSHandle* sh, const char* uri, const char* payload, LSFilterFunc callback, void* ctx, LSMessageToken* ret_token, LSError* error); bool LSCallCancel(LSHandle* sh, LSMessageToken token, LSError* error);