DbgPrint("Default PD destroyed event handler: %d\n", ret);
}
+static inline void default_lb_size_changed_cb(struct livebox *handler, int ret, void *data)
+{
+ DbgPrint("Default LB size changed event handler: %d\n", ret);
+}
+
static inline __attribute__((always_inline)) struct cb_info *create_cb_info(ret_cb_t cb, void *data)
{
struct cb_info *info;
* So the user can only get the resized value(result) from the first update event
* after this request.
*/
-
- if (cb)
+ if (ret == 0) {
+ handler->size_changed_cb = cb;
+ handler->size_cbdata = cbdata;
+ } else {
cb(handler, ret, cbdata);
+ }
}
static void text_signal_cb(struct livebox *handler, const struct packet *result, void *data)
return NULL;
}
+ if (livebox_service_is_enabled(pkgname) == 0) {
+ DbgPrint("Livebox [%s] is disabled package\n", pkgname);
+ return NULL;
+ }
+
if (type != LB_SIZE_TYPE_UNKNOWN)
livebox_service_get_size(type, &width, &height);
return -EFAULT;
}
+ if (!cb)
+ cb = default_lb_size_changed_cb;
+
return master_rpc_async_request(handler, packet, 0, resize_cb, create_cb_info(cb, data));
}
return master_rpc_request_only(NULL, packet);
}
+EAPI int livebox_refresh(struct livebox *handler)
+{
+ struct packet *packet;
+
+ if (!handler) {
+ ErrPrint("Hnalder is NIL\n");
+ return -EINVAL;
+ }
+
+ if (handler->state != CREATE || !handler->id)
+ return -EINVAL;
+
+ packet = packet_create_noack("update", "ss", handler->pkgname, handler->id);
+ if (!packet) {
+ ErrPrint("Failed to create a packet\n");
+ return -EFAULT;
+ }
+
+ return master_rpc_request_only(handler, packet);
+}
+
EAPI int livebox_refresh_group(const char *cluster, const char *category)
{
struct packet *packet;