};
enum access_event {
- ACCESS_READ,
- ACCESS_READ_NEXT,
- ACCESS_READ_PREV,
+ ACCESS_HIGHLIGHT,
+ ACCESS_HIGHLIGHT_NEXT,
+ ACCESS_HIGHLIGHT_PREV,
ACCESS_ACTIVATE,
- ACCESS_UP,
- ACCESS_DOWN,
+ ACCESS_VALUE_CHANGE,
+ ACCESS_SCROLL,
};
struct event_arg {
* \param[in] disp XDisplay object, if you don't know what this is, set NULL
* \param[in] name Slave name which is given by the master provider.
* \param[in] table Event handler table
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_init(void *disp, const char *name, struct event_handler *table, void *data);
* \brief Send the hello signal to the master
* Master will activate connection of this only if you send this hello event.
* or the master will reject all requests from your provider.
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_hello(void);
/*!
* \brief Send the ping message to the master to notify that your provider is working properly.
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_ping(void);
* \param[in] w Width of an updated content
* \param[in] h Height of an updated content
* \param[in] priority Priority of an updated content
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_updated(const char *pkgname, const char *id, int w, int h, double priority, const char *content, const char *title);
* \param[in] pkgname Package name of an updated livebox.
* \param[in] id Instance ID of an updated livebox.
* \param[in] descfile The filename of a description file.
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_desc_updated(const char *pkgname, const char *id, const char *descfile);
* \brief Send the deleted event of specified livebox instance
* \param[in] pkgname Package name of the livebox
* \param[in] id Livebox instance ID
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_deleted(const char *pkgname, const char *id);
* \param[in] pkgname Package name of the livebox
* \param[in] id Instance ID of the livebox
* \param[in] funcname Function name which will be called
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_ret(const char *pkgname, const char *id, const char *funcname);
* \param[in] pkgname Package name of the livebox
* \param[in] id Instance ID of the livebox
* \param[in] funcname Function name which is called by the slave
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_call(const char *pkgname, const char *id, const char *funcname);
* \param[in] pkgname Package name of the livebox
* \param[in] id ID of the livebox instance
* \param[in] funcname Reason of the fault error
- * \return int Success 0 otherwise errno < 0
+ * \return int Success LB_STATUS_SUCCESS otherwise errno < 0
*/
extern int provider_send_faulted(const char *pkgname, const char *id, const char *funcname);
+/*!
+ * \brief If you want notify to viewer to seize the screen,
+ * prevent moving a box from user event
+ * \param[in] pkgname Package name of the livebox
+ * \param[in] id ID of the livebox instance
+ * \param[in] seize 1 if viewer needs to hold a box, or 0
+ * \return int Success LB_STATUS_SUCCESS othere LB_STATUS_ERROR_XXX
+ */
+extern int provider_send_hold_scroll(const char *pkgname, const char *id, int seize);
+
#ifdef __cplusplus
}
#endif
return NULL;
}
-struct packet *master_pd_access_read(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_pd_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.pd_access.w, &arg.info.pd_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
+ if (ret != 5) {
+ ErrPrint("Invalid packet\n");
+ goto out;
+ }
+
+ arg.type = EVENT_PD_ACCESS;
+ arg.info.pd_access.event = ACCESS_VALUE_CHANGE;
+ if (s_info.table.pd_access)
+ (void)s_info.table.pd_access(&arg, s_info.data);
+
+out:
+ return NULL;
+}
+
+struct packet *master_pd_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+ struct event_arg arg;
+ double timestamp;
+ int ret;
+
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id, ×tamp, &arg.info.pd_access.x, &arg.info.pd_access.y);
+ if (ret != 5) {
+ ErrPrint("Invalid packet\n");
+ goto out;
+ }
+
+ arg.type = EVENT_PD_ACCESS;
+ arg.info.pd_access.event = ACCESS_SCROLL;
+ if (s_info.table.pd_access)
+ (void)s_info.table.pd_access(&arg, s_info.data);
+
+out:
+ return NULL;
+}
+
+struct packet *master_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
+{
+ struct event_arg arg;
+ double timestamp;
+ int ret;
+
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.pd_access.x, &arg.info.pd_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_PD_ACCESS;
- arg.info.pd_access.event = ACCESS_READ;
+ arg.info.pd_access.event = ACCESS_HIGHLIGHT;
if (s_info.table.pd_access)
(void)s_info.table.pd_access(&arg, s_info.data);
return NULL;
}
-struct packet *master_pd_access_read_prev(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.pd_access.w, &arg.info.pd_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.pd_access.x, &arg.info.pd_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_PD_ACCESS;
- arg.info.pd_access.event = ACCESS_READ_PREV;
+ arg.info.pd_access.event = ACCESS_HIGHLIGHT_PREV;
if (s_info.table.pd_access)
(void)s_info.table.pd_access(&arg, s_info.data);
return NULL;
}
-struct packet *master_pd_access_read_next(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.pd_access.w, &arg.info.pd_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.pd_access.x, &arg.info.pd_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_PD_ACCESS;
- arg.info.pd_access.event = ACCESS_READ_NEXT;
+ arg.info.pd_access.event = ACCESS_HIGHLIGHT_NEXT;
if (s_info.table.pd_access)
(void)s_info.table.pd_access(&arg, s_info.data);
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.pd_access.w, &arg.info.pd_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.pd_access.x, &arg.info.pd_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
return NULL;
}
-struct packet *master_lb_access_read(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.lb_access.w, &arg.info.lb_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.lb_access.x, &arg.info.lb_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_LB_ACCESS;
- arg.info.lb_access.event = ACCESS_READ;
+ arg.info.lb_access.event = ACCESS_HIGHLIGHT;
if (s_info.table.lb_access)
(void)s_info.table.lb_access(&arg, s_info.data);
return NULL;
}
-struct packet *master_lb_access_read_prev(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.lb_access.w, &arg.info.lb_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.lb_access.x, &arg.info.lb_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_LB_ACCESS;
- arg.info.lb_access.event = ACCESS_READ_PREV;
+ arg.info.lb_access.event = ACCESS_HIGHLIGHT_PREV;
if (s_info.table.lb_access)
(void)s_info.table.lb_access(&arg, s_info.data);
return NULL;
}
-struct packet *master_lb_access_read_next(pid_t pid, int handle, const struct packet *packet)
+struct packet *master_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
{
struct event_arg arg;
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.lb_access.w, &arg.info.lb_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.lb_access.x, &arg.info.lb_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
arg.type = EVENT_LB_ACCESS;
- arg.info.lb_access.event = ACCESS_READ_NEXT;
+ arg.info.lb_access.event = ACCESS_HIGHLIGHT_NEXT;
+ if (s_info.table.lb_access)
+ (void)s_info.table.lb_access(&arg, s_info.data);
+
+out:
+ return NULL;
+}
+
+struct packet *master_lb_access_value_change(pid_t pid, int handle, const struct packet *packet)
+{
+ struct event_arg arg;
+ double timestamp;
+ int ret;
+
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
+ ×tamp,
+ &arg.info.lb_access.x, &arg.info.lb_access.y);
+ if (ret != 5) {
+ ErrPrint("Invalid packet\n");
+ goto out;
+ }
+
+ arg.type = EVENT_LB_ACCESS;
+ arg.info.lb_access.event = ACCESS_VALUE_CHANGE;
+ if (s_info.table.lb_access)
+ (void)s_info.table.lb_access(&arg, s_info.data);
+
+out:
+ return NULL;
+}
+
+struct packet *master_lb_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+ struct event_arg arg;
+ double timestamp;
+ int ret;
+
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
+ ×tamp,
+ &arg.info.lb_access.x, &arg.info.lb_access.y);
+ if (ret != 5) {
+ ErrPrint("Invalid packet\n");
+ goto out;
+ }
+
+ arg.type = EVENT_LB_ACCESS;
+ arg.info.lb_access.event = ACCESS_SCROLL;
if (s_info.table.lb_access)
(void)s_info.table.lb_access(&arg, s_info.data);
double timestamp;
int ret;
- ret = packet_get(packet, "ssiiddd", &arg.pkgname, &arg.id,
- &arg.info.lb_access.w, &arg.info.lb_access.h,
+ ret = packet_get(packet, "ssdii", &arg.pkgname, &arg.id,
×tamp,
&arg.info.lb_access.x, &arg.info.lb_access.y);
- if (ret != 7) {
+ if (ret != 5) {
ErrPrint("Invalid packet\n");
goto out;
}
.cmd = "resume",
.handler = master_resume, /* timestamp, ret */
},
+
{
- .cmd = "pd_access_read",
- .handler = master_pd_access_read,
+ .cmd = "pd_access_hl",
+ .handler = master_pd_access_hl,
},
{
- .cmd = "pd_access_read_prev",
- .handler = master_pd_access_read_prev,
+ .cmd = "pd_access_hl_prev",
+ .handler = master_pd_access_hl_prev,
},
{
- .cmd = "pd_access_read_next",
- .handler = master_pd_access_read_next,
+ .cmd = "pd_access_hl_next",
+ .handler = master_pd_access_hl_next,
},
{
.cmd = "pd_access_activate",
.handler = master_pd_access_activate,
},
{
- .cmd = "lb_access_read",
- .handler = master_lb_access_read,
+ .cmd = "pd_access_scroll",
+ .handler = master_pd_access_scroll,
},
{
- .cmd = "lb_access_read_prev",
- .handler = master_lb_access_read_prev,
+ .cmd = "pd_access_value_change",
+ .handler = master_pd_access_value_change,
},
+
{
- .cmd = "lb_access_read_next",
- .handler = master_lb_access_read_next,
+ .cmd = "lb_access_hl",
+ .handler = master_lb_access_hl,
+ },
+ {
+ .cmd = "lb_access_hl_prev",
+ .handler = master_lb_access_hl_prev,
+ },
+ {
+ .cmd = "lb_access_hl_next",
+ .handler = master_lb_access_hl_next,
},
{
.cmd = "lb_access_activate",
.handler = master_lb_access_activate,
},
{
+ .cmd = "lb_access_scroll",
+ .handler = master_lb_access_scroll,
+ },
+ {
+ .cmd = "lb_access_value_change",
+ .handler = master_lb_access_value_change,
+ },
+
+ {
.cmd = NULL,
.handler = NULL,
},
return LB_STATUS_ERROR_INVALID;
}
- packet = packet_create_noack("call", "ssss", s_info.name, pkgname, id, funcname);
+ packet = packet_create_noack("call", "sss", pkgname, id, funcname);
if (!packet) {
ErrPrint("Failed to create a packet\n");
return LB_STATUS_ERROR_FAULT;
return LB_STATUS_ERROR_INVALID;
}
- packet = packet_create_noack("ret", "ssss", s_info.name, pkgname, id, funcname);
+ packet = packet_create_noack("ret", "sss", pkgname, id, funcname);
if (!packet) {
ErrPrint("Failed to create a packet\n");
return LB_STATUS_ERROR_FAULT;
return LB_STATUS_ERROR_INVALID;
}
- packet = packet_create_noack("faulted", "ssss", s_info.name, pkgname, id, funcname);
+ packet = packet_create_noack("faulted", "sss", pkgname, id, funcname);
if (!packet) {
ErrPrint("Failed to create a packet\n");
return LB_STATUS_ERROR_FAULT;
keep_file_in_safe(id);
- packet = packet_create_noack("updated", "sssiidss",
- s_info.name, pkgname, id, w, h, priority, content_info, title);
+ packet = packet_create_noack("updated", "ssiidss",
+ pkgname, id, w, h, priority, content_info, title);
if (!packet) {
ErrPrint("failed to build a packet\n");
return LB_STATUS_ERROR_FAULT;
if (!descfile)
descfile = util_uri_to_path(id); /* In case of the NULL descfilename, use the ID */
- packet = packet_create_noack("desc_updated", "ssss", s_info.name, pkgname, id, descfile);
+ packet = packet_create_noack("desc_updated", "sss", pkgname, id, descfile);
if (!packet) {
ErrPrint("Failed to build a packet\n");
return LB_STATUS_ERROR_FAULT;
return LB_STATUS_ERROR_INVALID;
}
- packet = packet_create_noack("deleted", "sss", s_info.name, pkgname, id);
+ packet = packet_create_noack("deleted", "ss", pkgname, id);
+ if (!packet) {
+ ErrPrint("Failed to build a packet\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ ret = com_core_packet_send_only(s_info.fd, packet);
+ packet_destroy(packet);
+ return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
+EAPI int provider_send_hold_scroll(const char *pkgname, const char *id, int hold)
+{
+ struct packet *packet;
+ int ret;
+
+ if (!pkgname || !id) {
+ ErrPrint("Invalid argument\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ if (s_info.fd < 0) {
+ ErrPrint("Connection is not established\n");
+ return LB_STATUS_ERROR_INVALID;
+ }
+
+ packet = packet_create_noack("scroll", "ssi", pkgname, id, !!hold);
if (!packet) {
ErrPrint("Failed to build a packet\n");
return LB_STATUS_ERROR_FAULT;