/* application id dose not exist, search application name */
appconf = (Ico_Uxf_conf_application *)ico_uxf_getAppByName(info->appid);
if (! appconf) {
- apfw_error("resource_reqcb: Leave(appid[%s] dose not exist)",
- info->appid);
+ apfw_error("resource_reqcb: Leave(appid[%s] dose not exist)", info->appid);
return;
}
}
(confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM) ||
(confsys->kind[appconf->kindId].priv == ICO_UXF_PRIVILEGE_SYSTEM_AUDIO))) {
/* System Program(ex. HomeScreen) no need resource control */
- apfw_trace("resource_reqcb: Leave(appid[%s] is system program)",
- info->appid);
+ apfw_trace("resource_reqcb: Leave(appid[%s] is system program)", info->appid);
return;
}
(*displaycontrol)(appconf, 1);
}
}
+ else {
+ apfw_trace("resource_reqcb: request state not ReplyActive(%x)", p->state);
+ }
p->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
p->timer = 0;
}
+ else {
+ apfw_warn("resource_reqcb: app(%s) resource(%d) dose not exist",
+ info->appid, info->id);
+ }
break;
default:
apfw_error("resource_reqcb: illegal command(%d)", info->state);
int prio;
int i, j;
Ico_Uxf_conf_application *conf = (Ico_Uxf_conf_application *)get_appconf(req->appid);
- Ico_Uxf_conf_display_zone *zone;
ico_apc_dispzone_t *czone;
ico_apc_request_t *p;
ico_apc_request_t *bp;
+ ico_apc_request_t *defp;
/* priority */
prio = getpriority(PRIO_PROCESS, req->pid);
req->zoneidx = i;
czone = &dispzone[i];
- zone = czone->conf;
/* search same request */
p = czone->req;
bp = NULL;
- while (p) {
- if ((strcmp(p->appid, req->appid) == 0) && (p->resid == req->resid) &&
- (p->zoneidx == req->zoneidx)) {
- break;
+ defp = NULL;
+ for (i = 0; i < ndispzone; i++) {
+ p = dispzone[i].req;
+ while (p) {
+ if ((strcmp(p->appid, req->appid) == 0) && (p->resid == req->resid)) {
+ if (p->zoneidx == req->zoneidx) break;
+ if ((req->reqtype == ICO_APC_REQTYPE_REQUEST) &&
+ (defp == NULL) && (p->reqtype != ICO_APC_REQTYPE_REQUEST)) {
+ apfw_trace("app_getdisplay: Found default request");
+ defp = p;
+ }
+ }
+ bp = p;
+ p = p->next;
}
- bp = p;
- p = p->next;
+ if (p) break;
+ }
+ if ((p == NULL) && (defp != NULL)) {
+ apfw_trace("app_getdisplay: change zone %s=>%s",
+ dispzone[defp->zoneidx].conf->name, dispzone[req->zoneidx].conf->name);
+ app_freedisplay(defp, 0);
}
if (p) {
- if (p->reqtype != ICO_APC_REQTYPE_REQUEST) {
+ if (req->reqtype != ICO_APC_REQTYPE_REQUEST) {
apfw_trace("app_getdisplay: Leave(found same request)");
return;
}
static void
change_disprequest(ico_apc_request_t *req, const int active)
{
- apfw_trace("change_disprequest: change to %s(%s)", active ? "active" : "inactive",
- req->appid);
+ apfw_trace("change_disprequest: %s change to %s(%s)", active ? "active" : "inactive",
+ dispzone[req->zoneidx].conf->name, req->appid);
req->state &= ~(ICO_APC_REQSTATE_REPLYACTIVE|ICO_APC_REQSTATE_REPLYQUIET);
p = czone2->overlap[i]->req;
if (p) {
if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
- p->state &= ~ICO_APC_REQSTATE_WAITPROC;
change_disprequest(p, 0);
}
+ p->state &= ~ICO_APC_REQSTATE_WAITPROC;
}
}
int prio;
int i, j;
Ico_Uxf_conf_application *conf = get_appconf(req->appid);
- Ico_Uxf_conf_sound_zone *zone;
ico_apc_soundzone_t *czone;
ico_apc_request_t *p;
ico_apc_request_t *bp;
req->zoneidx = i;
czone = &soundzone[i];
- zone = czone->conf;
/* search same request */
p = czone->req;
p = p->next;
}
if (p) {
- if (p->reqtype != ICO_APC_REQTYPE_REQUEST) {
+ if (req->reqtype != ICO_APC_REQTYPE_REQUEST) {
apfw_trace("app_getsound: Leave(found same request)");
return;
}
p = czone2->overlap[i]->req;
if (p) {
if ((p->state & ICO_APC_REQSTATE_WAITREQ) == 0) {
- p->state &= ~ICO_APC_REQSTATE_WAITPROC;
if (p->prio & ICO_UXF_PRIO_REGULATION) {
apfw_trace("recalc_soundzone: Overlap Stop %s(top and no regulation)",
p->appid);
p->state |= ICO_APC_REQSTATE_WAITREQ;
}
}
+ p->state &= ~ICO_APC_REQSTATE_WAITPROC;
}
}
/* change zone priority, if request application is top priority */
req->state |= ICO_APC_REQSTATE_WAITREQ;
if (ico_uxf_input_control(0, req->appid, czone->inputdev->device,
- czone->inputsw->input) != ICO_UXF_EOK) {
+ czone->inputsw->input, 0) != ICO_UXF_EOK) {
apfw_warn("app_getinput: send MIM Error");
}
if (inputcontrol) {
}
}
if (ico_uxf_input_control(1, req->appid, czone->inputdev->device,
- czone->inputsw->input) != ICO_UXF_EOK) {
+ czone->inputsw->input, 0) != ICO_UXF_EOK) {
apfw_warn("app_getinput: send MIM Error");
}
/* change lower priority stateus */
czone = &inputsw[req->zoneidx];
if (ico_uxf_input_control(0, conf->appid, czone->inputdev->device,
- czone->inputsw->input) != ICO_UXF_EOK) {
+ czone->inputsw->input, 0) != ICO_UXF_EOK) {
apfw_warn("app_freeinput: send MIM Error");
}
if (inputcontrol) {
}
}
if (ico_uxf_input_control(active, req->appid, czone->inputdev->device,
- czone->inputsw->input) != ICO_UXF_EOK) {
+ czone->inputsw->input, 0) != ICO_UXF_EOK) {
apfw_warn("app_getinput: send MIM Error");
}
if (inputcontrol) {
p = dispzone[i].req;
while (p) {
if (p->timer > 0) {
- if (p->timer >= ICO_APC_REQREPLY_INTERVAL)
+ if (p->timer > ICO_APC_REQREPLY_INTERVAL)
p->timer -= ICO_APC_REQREPLY_INTERVAL;
else
p->timer = 0;
p = soundzone[i].req;
while (p) {
if (p->timer > 0) {
- if (p->timer >= ICO_APC_REQREPLY_INTERVAL)
+ if (p->timer > ICO_APC_REQREPLY_INTERVAL)
p->timer -= ICO_APC_REQREPLY_INTERVAL;
else
p->timer = 0;
child_appid = NULL;
}
+ /* change all screen request (active counter down) */
+ for (i = 0; i < ndispzone; i++) {
+ p = dispzone[i].req;
+ while (p) {
+ if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
+ p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
+ }
+ p = p->next;
+ }
+ }
+
/* change all screen request from this application */
disp = 0;
for (i = 0; i < ndispzone; i++) {
bp = NULL;
while (p) {
if (appconf && (strcmp(p->appid, appconf->appid) == 0)) {
- apfw_trace("ico_syc_apc_active: disp %s prio=%08x is %s",
- p->appid, p->prio, bp ? "not top" : "top");
+ apfw_trace("ico_syc_apc_active: %08x disp %s prio=%08x is %s",
+ (int)p, p->appid, p->prio, bp ? "not top" : "top");
if ((p->prio & ICO_UXF_PRIO_ACTIVEAPP) != ICO_UXF_PRIO_ACTIVEAPP) {
p->prio |= ICO_UXF_PRIO_ACTIVEAPP;
- apfw_trace("ico_syc_apc_active: cgange active %s prio to %08x",
- p->appid, p->prio);
+ apfw_trace("ico_syc_apc_active: %08x cgange active %s prio to %08x",
+ (int)p, p->appid, p->prio);
flag ++;
if (bp) {
if (p2->prio <= p->prio) {
p->next = p2;
if (bp2) {
- apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
- p->appid, dispzone[i].req->appid,
+ apfw_trace("ico_syc_apc_active: %08x %s is not top=%s(%08x)",
+ (int)p, p->appid, dispzone[i].req->appid,
dispzone[i].req->prio);
bp2->next = p;
}
p2 = p2->next;
}
if (! p2) {
- apfw_trace("ico_syc_apc_active: %s is not top=%s(%08x)",
- p->appid, dispzone[i].req->appid,
+ apfw_trace("ico_syc_apc_active: %08x %s is not top=%s(%08x)",
+ (int)p, p->appid, dispzone[i].req->appid,
dispzone[i].req->prio);
if (bp2) {
bp2->next = p;
}
}
else {
- apfw_trace("ico_syc_apc_active: app %s is top", p->appid);
+ apfw_trace("ico_syc_apc_active: %08x app %s is top", (int)p, p->appid);
}
}
}
+ else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
+ p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
+ }
bp = p;
p = p->next;
}
if (flag) {
- p = dispzone[i].req;
- while (p) {
- if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
- p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
- }
- p = p->next;
- }
-
for (j = 0; j < disp; j++) {
if (dispzone[i].conf->display->id == reqdisp[j]) break;
}
}
}
}
+ else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
+ p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
+ }
bp = p;
p = p->next;
}
if (flag) {
- p = soundzone[i].req;
- while (p) {
- if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
- p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
- }
- p = p->next;
- }
-
for (j = 0; j < sound; j++) {
if (soundzone[i].conf->sound->id == reqsound[j]) break;
}
}
}
}
+ else if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
+ p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
+ }
bp = p;
p = p->next;
}
if (flag) {
- p = inputsw[i].req;
- while (p) {
- if (p->prio & ICO_UXF_PRIO_ACTIVEAPP) {
- p->prio -= ICO_UXF_PRIO_ACTIVECOUNT;
- }
- p = p->next;
- }
-
for (j = 0; j < input; j++) {
if (inputsw[i].inputsw->input == reqinput[j]) break;
}
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
-AC_INIT([org.tizen.ico.homescreen], [0.0.1], [])
+AC_INIT([org.tizen.ico.homescreen], [0.7.01], [])
AM_INIT_AUTOMAKE([foreign 1.11])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
AC_SUBST(AUL_CFLAGS)
AC_SUBST(AUL_LIBS)
+UWS_CFLAGS="-I/usr/include/ico-util"
+UWS_LIBS="-lico-util-com"
+AC_SUBST(UWS_CFLAGS)
+AC_SUBST(UWS_LIBS)
+
PKG_CHECK_MODULES([SLPPKGMGR], [pkgmgr])
SLPPKGMGR_CFLAGS="$SLPPKGMGR_CFLAGS"
SLPPKGMGR_LIBS="$SLPPKGMGR_LIBS"
+[Desktop Entry]
Name=HomeScreen
Type=menu
-Exec=/opt/apps/org.tizen.ico.homescreen/bin/HomeScreen
+Exec=/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen
Icon=org.tizen.ico.homescreen.png
NoDisplay=false
-Version=0.1.0
+Version=0.7.0
Comment=home screen app
Categories=Menu;HomeScreen;run=Center;noauto
+[Desktop Entry]
Name=OnScreen
Type=menu
-Exec=/opt/apps/org.tizen.ico.onscreen/bin/OnScreen
+Exec=/usr/apps/org.tizen.ico.onscreen/bin/OnScreen
Icon=org.tizen.ico.onscreen.png
NoDisplay=false
-Version=0.1.0
+Version=0.7.0
Comment=onscreen app
Categories=Menu;HomeScreen;run=Center;auto
+++ /dev/null
-Name=sampleAlignment
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.alignment/bin/DummyApp -number=6
-Icon=org.tizen.ico.sample.alignment.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleBrowser
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.browser/bin/DummyApp -number=4
-Icon=org.tizen.ico.sample.browser.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleEnginestatus
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.enginestatus/bin/DummyApp -number=19
-Icon=org.tizen.ico.sample.enginestatus.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleMail
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.mail/bin/DummyApp -number=2
-Icon=org.tizen.ico.sample.mail.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleMeter
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.meter/bin/DummyApp -number=17
-Icon=org.tizen.ico.sample.meter.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleMusic
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.music/bin/DummyApp -number=1
-Icon=org.tizen.ico.sample.music.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleSeatarrange
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.seatarrange/bin/DummyApp -number=5
-Icon=org.tizen.ico.sample.seatarrange.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+++ /dev/null
-Name=sampleSetup
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.setup/bin/DummyApp -number=12
-Icon=org.tizen.ico.sample.setup.png
-Version=0.1.0
-NoDisplay=false
-Comment=Dummy
+++ /dev/null
-Name=sampleWeather
-Type=Application
-Exec=/opt/apps/org.tizen.ico.sample.weather/bin/DummyApp -number=3
-Icon=org.tizen.ico.sample.weather.png
-NoDisplay=false
-Version=0.1.0
-Comment=Dummy
+[Desktop Entry]
Name=StatusBar
Type=menu
-Exec=/opt/apps/org.tizen.ico.statusbar/bin/StatusBar
+Exec=/usr/apps/org.tizen.ico.statusbar/bin/StatusBar
Icon=org.tizen.ico.statusbar.png
NoDisplay=false
-Version=0.1.0
+Version=0.7.0
Comment=status bar app
Categories=Menu;HomeScreen;run=Center;auto
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.homescreen" version="0.7.0" install-location="internal-only">
+ <label>HomeScreen</label>
+ <description>IVI HomeScreen Application</description>
+ <ui-application appid="org.tizen.ico.homescreen" exec="/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.ico.homescreen.png</icon>
+ <label>HomeScreen</label>
+ <label xml:lang="en-gb">HomeScreen</label>
+ <label xml:lang="en-us">HomeScreen</label>
+ </ui-application>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.onscreen" version="0.7.0" install-location="internal-only">
+ <label>OnScreen</label>
+ <description>IVI OnScreen Application</description>
+ <ui-application appid="org.tizen.ico.onscreen" exec="/usr/apps/org.tizen.ico.onscreen/bin/OnScreen" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.ico.onscreen.png</icon>
+ <label>OnScreen</label>
+ <label xml:lang="en-gb">OnScreen</label>
+ <label xml:lang="en-us">OnScreen</label>
+ </ui-application>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.statusbar" version="0.7.0" install-location="internal-only">
+ <label>StatusBar</label>
+ <description>IVI StatusBar Application</description>
+ <ui-application appid="org.tizen.ico.statusbar" exec="/usr/apps/org.tizen.ico.statusbar/bin/StatusBar" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.ico.statusbar.png</icon>
+ <label>StatusBar</label>
+ <label xml:lang="en-gb">StatusBar</label>
+ <label xml:lang="en-us">StatusBar</label>
+ </ui-application>
+</manifest>
lib_LTLIBRARIES = libico-app-fw.la \
libico-app-fw-efl.la
-#include_HEADERS = \
-# ico_apf.h \
-# ico_apf_error.h \
-# ico_apf_resource_control.h \
-# ico_apf_ecore.h
-
-libico_app_fw_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin $(AUL_CFLAGS) $(SLPPKGMGR_CFLAGS) @GLIB_CFLAGS@
+libico_app_fw_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin -I/usr/include/ico-util $(AUL_CFLAGS) $(SLPPKGMGR_CFLAGS) @GLIB_CFLAGS@
libico_app_fw_la_LIBADD = $(WL_LIBS) $(AUL_LIBS) $(SLPPKGMGR_LIBS) @GLIB_LIBS@
-libico_app_fw_la_LDFLAGS = -version-info 0:5:0
+libico_app_fw_la_LDFLAGS = -version-info 0:7:0
libico_app_fw_la_SOURCES = \
ico_uxf_conf_common.c \
ico_uxf_conf_sys.c \
libico_app_fw_efl_la_CFLAGS = -I../include -I/usr/include/ico-uxf-weston-plugin $(EFL_CFLAGS) @GLIB_CFLAGS@
libico_app_fw_efl_la_LIBADD = $(WL_LIBS) $(EFL_LIBS) @GLIB_LIBS@
-libico_app_fw_efl_la_LDFLAGS = -version-info 0:5:0
+libico_app_fw_efl_la_LDFLAGS = -version-info 0:7:0
libico_app_fw_efl_la_SOURCES = \
ico_apf_ecore.c \
ico_uxf_conf_ecore.c
#include <unistd.h>
#include <getopt.h>
#include <string.h>
+#include <poll.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <libwebsockets.h>
+#include <ico_uws.h>
#include "ico_apf_private.h"
#include "ico_uxf_conf.h"
static int ico_apf_com_connect(ico_apf_com_handle_t *handle);
static int ico_apf_com_realsend(ico_apf_com_handle_t *handle,
ico_apf_com_buffer_t *msg);
-static int ico_apf_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len);
-static int ico_apf_callback_websock(struct libwebsocket_context *this,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len);
+static void ico_apf_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e reason, const void *id,
+ const ico_uws_detail *detail, void *user_data);
static void ico_apf_put_recvmsg(const int cmd, const int res, const int pid,
const char *appid, char *msg, const int len,
ico_apf_com_handle_t *handle);
extern const char *program_invocation_name;
/* application framework control handle */
-static struct libwebsocket_context *global_lwscontext = NULL;
+static struct ico_uws_context *global_uwscontext = NULL;
static ico_apf_com_handle_t *handles = NULL;
static ico_apf_com_handle_t *freehandles = NULL;
static ico_apf_com_eventlistener global_listener = NULL;
static void *global_user_data = NULL;
-/* flag for callback from libwebsockets */
-static int lws_callbacked = 0;
-
-/* libwebsockets's protocol number */
-enum appsctl_protocols {
- PROTOCOL_HTTP, /* HTTP handshake(Certainly required) */
- PROTOCOL_APPSCONTROLLER, /* AppsController protocol */
- PROTOCOL_APPSEND /* everytime means final */
-};
-enum soundmgr_protocols {
- PROTOCOL_SOUNDMGR, /* Multi Sound Manager protocol */
- PROTOCOL_SOUNDEND /* everytime means final */
-};
-
-/* list of libwebsockets protocol for AppsController */
-static struct libwebsocket_protocols apps_protocols[] = {
- /* HTTP handshake(Certainly required) */
- { "http_only", ico_apf_callback_http, 0 },
- /* callback from websocket to appscontroller*/
- { ICO_PROTOCOL_APPSCONTROLLER, ico_apf_callback_websock, sizeof(void *) },
- { NULL, NULL, 0 } /* everytime means final */
-};
-
-/* list of libwebsockets protocol for pulse-audio plugin */
-static struct libwebsocket_protocols sound_protocols[] = {
- /* callback from websocket to soundmanager*/
- { ICO_PROTOCOL_MULTISOUNDMANAGER, ico_apf_callback_websock, sizeof(void *) },
- { NULL, NULL, 0 } /* everytime means final */
-};
+/* flag for callback from comminucation */
+static int uws_callbacked = 0;
/* command/event string */
const char *ico_apf_cmd_table[] = {
ico_apf_com_init_client(const char *uri, const int type)
{
int i;
+ int ret;
int port;
char* address;
ico_apf_com_poll_t *p;
handle->ip[ICO_APF_RESOURCE_IP_LEN-1] = 0;
/* connect to AppsController */
- i = ico_apf_com_connect(handle);
+ ret = ico_apf_com_connect(handle);
if (! ifsysconf) {
ico_uxf_closeSysConfig();
}
- if (i != ICO_APF_RESOURCE_E_NONE) {
+ if (ret != ICO_APF_RESOURCE_E_NONE) {
apfw_error("ico_apf_com_init_client: Leave(RESOURCE_E_INIT_COM_FAILD)");
(void) ico_apf_com_term_client(handle);
return NULL;
}
/* Try to connection */
- ico_apf_com_dispatch(handle, 0);
- handle->fd = libwebsocket_get_socket_fd(handle->wsi_connection);
+ ico_apf_com_dispatch(handle);
/* add poll callback if fd is exist */
if (handle->fd > 0) {
ico_apf_com_init_server(const char *uri, const int type)
{
int i;
+ int ret;
int port;
int svrtype;
char* address;
Ico_Uxf_Sys_Config *sysconf;
Ico_Uxf_Sys_Config *ifsysconf = (Ico_Uxf_Sys_Config *)0xffffffff;
char *port_env;
+ char uri_name[32];
apfw_trace("ico_apf_com_init_server: Enter(%s,%d)",
uri ? uri : "(NULL)", type);
handle->ip[ICO_APF_RESOURCE_IP_LEN-1] = 0;
/* connect to AppsController */
- handle->wsi_context = libwebsocket_create_context(port, NULL, apps_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- if (! handle->wsi_context) {
- apfw_error("ico_apf_com_init_server: Leave(libwebsockets create Error)");
+ snprintf(uri_name, sizeof(uri_name), ":%d", port);
+ handle->uws_context = ico_uws_create_context(uri_name, ICO_PROTOCOL_APPSCONTROLLER);
+
+ if (! handle->uws_context) {
+ apfw_error("ico_apf_com_init_server: Leave(ico_uws_create_context create Error)");
(void) ico_apf_com_term_server(handle);
return NULL;
}
apfw_trace("ico_apf_com_init_server: create server context 0x%08x",
- (int)handle->wsi_context);
+ (int)handle->uws_context);
- global_lwscontext = handle->wsi_context;
+ ret = ico_uws_set_event_cb(handle->uws_context, ico_apf_callback_uws, (void *)handle);
+ if (ret != ICO_UWS_ERR_NONE) {
+ apfw_error("co_apf_com_init_server: ico_uws_set_event_cb Error(%d)", ret);
+ apfw_trace("ico_apf_com_init_server: Leave(ERR)");
+ return NULL;
+ }
- ico_apf_com_dispatch(handle, 0);
+ global_uwscontext = handle->uws_context;
+
+ ico_apf_com_dispatch(handle);
apfw_trace("ico_apf_com_init_server: Leave(OK)");
return handle;
handle->next = NULL;
handle->fd = 0;
handle->pid = 0;
- handle->wsi_context = NULL;
- handle->wsi_connection = NULL;
+ handle->uws_context = NULL;
+ handle->uws_id = NULL;
handle->service_on = 0;
handle->retry = 0;
- handle->stoprecv = 0;
handle->shead = 0;
handle->stail = 0;
handle->rhead = 0;
static int
ico_apf_com_connect(ico_apf_com_handle_t *handle)
{
- int rep;
+ int ret;
+ char *protocol;
+ char uri_name[64];
apfw_trace("ico_apf_com_connect: Enter(type=%d)", handle->type);
- int ietf_version = -1; /* latest */
- char origin[1024];
- sprintf(origin,"%d %s",getpid(),program_invocation_name);
-
- apfw_trace("ico_apf_com_connect: libwebsocket_create_context");
- handle->wsi_context = libwebsocket_create_context(
- CONTEXT_PORT_NO_LISTEN, NULL,
- (handle->type & ICO_APF_COM_TYPE_CONNECTION)
- == ICO_APF_COM_TYPE_SOUNDMGR ?
- sound_protocols : apps_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- if (handle->wsi_context == NULL) {
- apfw_error("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
+ snprintf(uri_name, sizeof(uri_name), "ws://%s:%d", handle->ip, handle->port);
+ if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR)
+ protocol = ICO_PROTOCOL_MULTISOUNDMANAGER;
+ else
+ protocol = ICO_PROTOCOL_APPSCONTROLLER;
+ handle->uws_context = ico_uws_create_context(uri_name, protocol);
+
+ if (handle->uws_context == NULL) {
+ apfw_error("ico_apf_com_connect: ico_uws_create_context Error(%s,%s)",
+ uri_name, protocol);
+ apfw_trace("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
}
apfw_trace("ico_apf_com_connect: create client context 0x%08x",
- (int)handle->wsi_context);
-
- /* connect to Application Manager by WebSocket */
- apfw_trace("ico_apf_com_connect: libwebsocket_client_connect %s:%d",
- handle->ip, handle->port);
- for (rep = 0; rep < (1000/50); rep++) {
- handle->wsi_connection = libwebsocket_client_connect(
- handle->wsi_context,
- handle->ip, handle->port, 0,
- "/", handle->ip, origin,
- (handle->type == ICO_APF_COM_TYPE_APPSCTL) ?
- apps_protocols[PROTOCOL_APPSCONTROLLER].name :
- sound_protocols[PROTOCOL_SOUNDMGR].name,
- ietf_version);
- if (handle->wsi_connection) break;
- usleep(50*1000);
- }
- if (handle->wsi_connection == NULL) {
- apfw_warn("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
+ (int)handle->uws_context);
+
+ ret = ico_uws_set_event_cb(handle->uws_context, ico_apf_callback_uws, (void *)handle);
+ if (ret != ICO_UWS_ERR_NONE) {
+ apfw_error("ico_apf_com_connect: ico_uws_set_event_cb Error(%d)", ret);
+ apfw_trace("ico_apf_com_connect: Leave(RESOURCE_E_INIT_COM_FAILD)");
return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
}
- handle->fd = libwebsocket_get_socket_fd(handle->wsi_connection);
+
+ /* dispatch for connection */
+ ico_apf_com_dispatch(handle);
+
if (handle->fd > 0) {
(void)ico_apf_poll_fd_add(handle->fd, POLLIN|POLLOUT);
}
- ico_apf_com_dispatch(handle, 0);
apfw_trace("ico_apf_com_connect: Leave(OK, fd=%d)", handle->fd);
return ICO_APF_RESOURCE_E_NONE;
* Connecting AppsController program must call this function.
*
* @param[in] handle connect handle, if NULL target is all connect
- * @param[in] timeoutms maximum wait time on miri-sec.
- * 0 is no wait, -1 is wait forever.
* @return non
*/
/*--------------------------------------------------------------------------*/
void
-ico_apf_com_dispatch(ico_apf_com_handle_t *handle, const int timeoutms)
+ico_apf_com_dispatch(ico_apf_com_handle_t *handle)
{
int rh;
int n;
}
while (p) {
- if (libwebsocket_service(p->wsi_context, timeoutms) < 0) {
- apfw_warn("ico_apf_com_dispatch: fd=%d is done", p->fd);
- }
+ ico_uws_service(p->uws_context);
/* If received data is suspended, it processes. */
while (p->rtail != p->rhead) {
if (n < 0) {
n = ICO_APF_RESOURCE_WSOCK_BUFR + n;
}
- if ((p->stoprecv != 0) &&
- (n < (ICO_APF_RESOURCE_WSOCK_BUFR/2))) {
- /* If suspending received data is bellow half, request a send process */
- p->stoprecv = 0;
- apfw_trace("ico_apf_com_dispatch: Flow Control(Start) %d", n);
- libwebsocket_rx_flow_control(p->wsi_connection, 1);
- libwebsocket_service(p->wsi_context, 0);
- }
if (p->listener != NULL) {
handle->listener(p, p->rbuf[rh]->cmd, p->rbuf[rh]->res, p->rbuf[rh]->pid,
p->rbuf[rh]->appid, p->rbuf[rh]->msg, p->user_data);
- libwebsocket_service(p->wsi_context, 0);
+ ico_uws_service(p->uws_context);
}
else if (global_listener != NULL) {
global_listener(p, p->rbuf[rh]->cmd, p->rbuf[rh]->res, p->rbuf[rh]->pid,
p->rbuf[rh]->appid, p->rbuf[rh]->msg, global_user_data);
- libwebsocket_service(p->wsi_context, 0);
+ ico_uws_service(p->uws_context);
}
}
if (handle) break;
p->next = handle->next;
}
- if (handle->wsi_context) {
- libwebsocket_context_destroy(handle->wsi_context);
+ if (handle->uws_context) {
+ ico_uws_unset_event_cb(handle->uws_context);
+ ico_uws_close(handle->uws_context);
}
handle->next = freehandles;
freehandles = handle;
p->next = handle->next;
}
- if (handle->wsi_context) {
- libwebsocket_context_destroy(handle->wsi_context);
+ if (handle->uws_context) {
+ ico_uws_unset_event_cb(handle->uws_context);
+ ico_uws_close(handle->uws_context);
}
handle->next = freehandles;
freehandles = handle;
const int cmd, const int res, const char *appid, char *msg)
{
int st;
+ int cur;
int len;
- apfw_trace("ico_apf_com_send: Enter(%08x, %d, %d)", (int)handle, cmd, res);
+ apfw_trace("ico_apf_com_send: Enter(%08x, %d, %d) callback=%d",
+ (int)handle, cmd, res, uws_callbacked);
if ((handle == NULL) || (! ico_apf_com_isconnected(handle))) {
apfw_warn("ico_apf_com_send: Leave(not initialized)");
}
st = handle->stail;
+ cur = st;
if (st >= (ICO_APF_RESOURCE_WSOCK_BUFS-1)) {
st = 0;
ico_apf_poll_fd_del(handle->fd);
return ICO_APF_RESOURCE_E_COMMUNICATION;
}
+ handle->stail = st;
/* accumulate send buffer */
if ((! appid) || (*appid == 0)) {
- handle->sbuf[handle->stail]->pid = getpid();
- handle->sbuf[handle->stail]->appid[0] = 0;
+ handle->sbuf[cur]->pid = getpid();
+ handle->sbuf[cur]->appid[0] = 0;
}
else {
- handle->sbuf[handle->stail]->pid = 0;
- strncpy(handle->sbuf[handle->stail]->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
- handle->sbuf[handle->stail]->appid[ICO_UXF_MAX_PROCESS_NAME] = 0;
+ handle->sbuf[cur]->pid = 0;
+ strncpy(handle->sbuf[cur]->appid, appid, ICO_UXF_MAX_PROCESS_NAME);
+ handle->sbuf[cur]->appid[ICO_UXF_MAX_PROCESS_NAME] = 0;
}
apfw_trace("ico_apf_com_send: Send.%d:%d %d %d(%s) <%s>",
- handle->stail, cmd, res, handle->sbuf[handle->stail]->pid,
- handle->sbuf[handle->stail]->appid, msg);
- handle->sbuf[handle->stail]->cmd = cmd;
- handle->sbuf[handle->stail]->res = res;
- memcpy(handle->sbuf[handle->stail]->msg, msg, len);
- handle->sbuf[handle->stail]->msg[len] = 0;
- handle->stail = st;
-
- libwebsocket_callback_on_writable(handle->wsi_context, handle->wsi_connection);
-
- if (lws_callbacked) {
- /* send call from libwensockets callback, delayed send */
+ handle->stail, cmd, res, handle->sbuf[cur]->pid,
+ handle->sbuf[cur]->appid, msg);
+ handle->sbuf[cur]->cmd = cmd;
+ handle->sbuf[cur]->res = res;
+ memcpy(handle->sbuf[cur]->msg, msg, len);
+ handle->sbuf[cur]->msg[len] = 0;
+
+ if (uws_callbacked) {
+ /* send call from communication callback, delayed send */
ico_apf_poll_write_event(handle, 1);
}
else {
/* not call from callback, direct send */
- ico_apf_com_dispatch(handle, 0); /* try to service */
+ apfw_trace("ico_apf_com_send: direct send(context=%08x id=%08x)",
+ (int)handle->uws_context, (int)handle->uws_id);
+ if ((handle->uws_context != NULL) &&
+ (handle->uws_id != NULL)) {
+ st = handle->shead;
+ if (handle->shead >= (ICO_APF_RESOURCE_WSOCK_BUFS-1)) {
+ handle->shead = 0;
+ }
+ else {
+ handle->shead ++;
+ }
+ if (ico_apf_com_realsend(handle, handle->sbuf[st])
+ != ICO_APF_RESOURCE_E_NONE) {
+ apfw_warn("ico_apf_com_send: ico_apf_com_realsend Error");
+ handle->shead = st;
+ }
+ }
+ ico_apf_com_dispatch(handle); /* try to service */
}
apfw_trace("ico_apf_com_send: Leave(OK)");
return ICO_APF_RESOURCE_E_NONE;
static int
ico_apf_com_realsend(ico_apf_com_handle_t *handle, ico_apf_com_buffer_t *msg)
{
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 +
- LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *pt = &buf[LWS_SEND_BUFFER_PRE_PADDING];
- int n;
+ char buf[256];
apfw_trace("ico_apf_com_realsend: Enter");
if ((handle == NULL) || (! ico_apf_com_isconnected(handle))) {
if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR) {
/* send to Multi Sound Manager */
if (msg->res) {
- sprintf((char *)pt, "%s %d",
+ snprintf(buf, sizeof(buf), "%s %d",
ico_apf_sound_table[msg->cmd-ICO_APF_SOUND_COMMAND_MIN], msg->res);
}
else {
- strcpy((char *)pt, ico_apf_sound_table[msg->cmd-ICO_APF_SOUND_COMMAND_MIN]);
+ strcpy(buf, ico_apf_sound_table[msg->cmd-ICO_APF_SOUND_COMMAND_MIN]);
}
}
else {
/* send tp AppsController */
if (msg->appid[0]) {
- sprintf((char *)pt, "%s %s %s %s",
- ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
- ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
- msg->appid, msg->msg);
+ snprintf(buf, sizeof(buf), "%s %s %s %s",
+ ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
+ ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
+ msg->appid, msg->msg);
}
else {
- sprintf((char *)pt, "%s %s %d %s",
- ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
- ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
- msg->pid, msg->msg);
+ snprintf(buf, sizeof(buf), "%s %s %d %s",
+ ico_apf_cmd_table[msg->cmd-ICO_APF_RESOURCE_COMMAND_MIN],
+ ico_apf_res_table[msg->res-ICO_APF_RESOURCE_RESID_MIN],
+ msg->pid, msg->msg);
}
}
- apfw_trace("ico_apf_com_realsend: libwebsocket_write[%s]", pt);
- n = libwebsocket_write(handle->wsi_connection,
- pt, strlen((char *)pt), LWS_WRITE_TEXT);
- if (n < 0) {
- apfw_error("ico_apf_com_realsend: write error[%d]", n);
- ico_apf_poll_fd_del(handle->fd);
- return ICO_APF_RESOURCE_E_COMMUNICATION;
- }
- usleep(200); /* According to libwebsockets's sample, this is required */
+ apfw_trace("ico_apf_com_realsend: ico_uws_send[%s]", buf);
+ ico_uws_send(handle->uws_context, handle->uws_id, (unsigned char *)buf, strlen(buf));
+
apfw_trace("ico_apf_com_realsend: Leave(OK)");
return ICO_APF_RESOURCE_E_NONE;
}
/*--------------------------------------------------------------------------*/
/**
- * @brief ico_apf_callback_http
- * Connection status is notified from libwebsockets.
+ * @brief ico_apf_callback_uws
+ * this callback function notified from communication.
*
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
+ * @param[in] context communication context
* @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-ico_apf_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len)
-{
- int fd;
-
- fd = libwebsocket_get_socket_fd(wsi);
- lws_callbacked ++;
-
- switch (reason) {
- case LWS_CALLBACK_FILTER_NETWORK_CONNECTION:
- /* a connection demand is received */
- apfw_trace("ico_apf_callback_http: LWS_CALLBACK_FILTER_NETWORK_CONNECTION fd=%d", fd);
-
- /* If connection is refused, it will return with values other than zero.*/
- /* At present, since access control is not introduced, */
- /* connection is always permitted. */
- break;
-
- case LWS_CALLBACK_ADD_POLL_FD: /* add connection socket */
- apfw_trace("ico_apf_callback_http: LWS_CALLBACK_ADD_POLL_FD(%d) %d,%x", fd,
- (int)user, len);
- (void)ico_apf_poll_fd_add((int)user, (int)len);
- break;
-
- case LWS_CALLBACK_DEL_POLL_FD: /* delete connection socket */
- apfw_trace("ico_apf_callback_http: LWS_CALLBACK_DEL_POLL_FD(%d) %d,%x", fd,
- (int)user, len);
- ico_apf_poll_fd_del((int)user);
- break;
-
- case LWS_CALLBACK_SET_MODE_POLL_FD: /* set status */
- apfw_trace("ico_apf_callback_http: LWS_CALLBACK_SET_MODE_POLL_FD(%d) %d,%x", fd,
- (int)user, len);
- (void)ico_apf_poll_fd_add((int)user, (int)len);
- break;
-
- case LWS_CALLBACK_CLEAR_MODE_POLL_FD: /* clear status */
- apfw_trace("ico_apf_callback_http: LWS_CALLBACK_CLEAR_MODE_POLL_FD(%d) %d,%x", fd,
- (int)user, len);
- (void)ico_apf_poll_fd_add((int)user, -((int)len));
- break;
-
- default:
- apfw_trace("ico_apf_callback_http: Unknown reason(%d, fd=%d)", reason, fd);
- break;
- }
- lws_callbacked --;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief ico_apf_callback_websock
- * this callback function notified from libwebsockets.
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @param[in] id communication management table
+ * @param[in] detail event detail information
+ * @param[in] user_data communication handle
+ * @return none
*/
/*--------------------------------------------------------------------------*/
-static int
-ico_apf_callback_websock(struct libwebsocket_context * this,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len)
+static void
+ico_apf_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e reason, const void *id,
+ const ico_uws_detail *detail, void *user_data)
{
- int wsifd;
int st;
int cmd;
int res;
int i;
int strlen;
char *msg;
- ico_apf_com_poll_t *p;
+ int len;
ico_apf_com_handle_t *handle;
- struct sockaddr_in sin;
- unsigned int sin_len;
+ ico_apf_com_handle_t *handle2;
char appid[ICO_UXF_MAX_PROCESS_NAME+1];
char strname[ICO_UXF_MAX_STREAM_NAME+1];
int nparam;
short end;
} param[10];
- wsifd = libwebsocket_get_socket_fd(wsi);
-
- lws_callbacked ++;
+ handle = (ico_apf_com_handle_t *)user_data;
+ uws_callbacked ++;
- if (reason == LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION) {
- apfw_trace("ico_apf_callback_websock: server side connected from client");
-
- /* connect from client */
- handle = handles;
- while (handle) {
- if (handle->fd == wsifd) break;
- handle = handle->next;
+ if (handle->type == ICO_APF_COM_TYPE_SVR_APPSCTL) {
+ /* search client handle for server */
+ handle2 = handles;
+ while (handle2) {
+ if (handle2->uws_id == id) break;
+ handle2 = handle2->next;
}
- if (! handle) {
- handle = ico_apf_alloc_handle();
- if (! handle) {
- lws_callbacked --;
- apfw_error("ico_apf_callback_websock: No Memory");
- return 1;
- }
- }
- handle->type = ICO_APF_COM_TYPE_APPSCTL;
- handle->wsi_context = global_lwscontext;
- handle->wsi_connection = wsi;
- handle->fd = wsifd;
- handle->service_on = 0;
- handle->stoprecv = 0;
-
- sin_len = sizeof(sin);
- if (getpeername(wsifd, (struct sockaddr *) &sin, &sin_len) >= 0) {
- sprintf(handle->ip, "%u.%u.%u.%u",
- (sin.sin_addr.s_addr) & 0x0ff,
- (sin.sin_addr.s_addr >> 8) & 0x0ff,
- (sin.sin_addr.s_addr >> 16) & 0x0ff,
- (sin.sin_addr.s_addr >> 24) & 0x0ff);
+ if (handle2) {
+ handle = handle2;
}
else {
- strcpy(handle->ip, "127.0.0.1");
- }
+ apfw_trace("ico_apf_callback_uws: new server side client");
- p = com_polls;
- while (p) {
- if (p->fd == handle->fd) {
- p->apf_fd_control = (void *)handle;
- handle->poll = p;
+ handle = ico_apf_alloc_handle();
+ if (! handle) {
+ uws_callbacked --;
+ apfw_error("ico_apf_callback_uws: No Memory");
+ return;
}
- p = p->next;
+ apfw_trace("ico_apf_callback_uws: create new handle(%08x)", (int)handle);
+ handle->type = ICO_APF_COM_TYPE_APPSCTL;
+ handle->uws_context = (struct ico_uws_context *)context;
+ handle->uws_id = (void *)id;
+ handle->service_on = 0;
+
+ strncpy(handle->ip, ico_uws_get_uri(handle->uws_context),
+ ICO_APF_RESOURCE_IP_LEN-1);
}
- lws_callbacked --;
- apfw_trace("ico_apf_callback_websock: server side connected");
- return 0;
- }
-
- handle = handles;
- while (handle) {
- if (handle->wsi_connection == wsi) break;
- handle = handle->next;
- }
-
- if (! handle) {
- lws_callbacked --;
- apfw_trace("ico_apf_callback_websock: Handle not exist");
- return 0;
}
switch (reason) {
- case LWS_CALLBACK_CLIENT_ESTABLISHED:
- case LWS_CALLBACK_ESTABLISHED:
- apfw_trace("ico_apf_callback_websock: LWS_CALLBACK_ESTABLISHED");
+ case ICO_UWS_EVT_OPEN:
+ apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_OPEN");
+ handle->uws_id = (void *)id;
handle->service_on = 1;
- handle->stoprecv = 0;
/* save receive message to receive buffer */
ico_apf_put_recvmsg(ICO_APF_RESOURCE_STATE_CONNECTED, 0,
handle->pid, "\0", NULL, 0, handle);
break;
- case LWS_CALLBACK_ADD_POLL_FD: /* add connection socket */
- (void)ico_apf_poll_fd_add((int)user, (int)len);
+ case ICO_UWS_EVT_ADD_FD: /* add connection socket */
+ apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_ADD_FD(%d)", detail->_ico_uws_fd.fd);
+ handle->fd = detail->_ico_uws_fd.fd;
+ (void)ico_apf_poll_fd_add(detail->_ico_uws_fd.fd, POLLIN|POLLOUT);
break;
- case LWS_CALLBACK_DEL_POLL_FD: /* delete connection socket */
- ico_apf_poll_fd_del((int)user);
- break;
-
- case LWS_CALLBACK_SET_MODE_POLL_FD: /* set status */
- (void)ico_apf_poll_fd_add((int)user, (int)len);
- break;
-
- case LWS_CALLBACK_CLEAR_MODE_POLL_FD: /* clear status */
- (void)ico_apf_poll_fd_add((int)user, -((int)len));
+ case ICO_UWS_EVT_DEL_FD: /* delete connection socket */
+ apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_DEL_FD(%d)", detail->_ico_uws_fd.fd);
+ handle->fd = 0;
+ ico_apf_poll_fd_del(detail->_ico_uws_fd.fd);
break;
- case LWS_CALLBACK_CLOSED:
- apfw_trace("ico_apf_callback_websock: LWS_CALLBACK_CLOSED");
+ case ICO_UWS_EVT_CLOSE:
+ apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_CLOSE pid=%d", handle->pid);
handle->service_on = 0;
+ handle->uws_id = NULL;
+ pid = handle->pid;
+ handle->pid = 0;
/* save receive message to receive buffer */
ico_apf_put_recvmsg(ICO_APF_RESOURCE_STATE_DISCONNECTED, 0,
- handle->pid, "\0", NULL, 0, handle);
- break;
-
- case LWS_CALLBACK_CLIENT_WRITEABLE:
- case LWS_CALLBACK_SERVER_WRITEABLE:
- if (handle->stail != handle->shead) {
- st = handle->shead;
- if (handle->shead >= (ICO_APF_RESOURCE_WSOCK_BUFS-1)) {
- handle->shead = 0;
- }
- else {
- handle->shead ++;
- }
- if (ico_apf_com_realsend(handle, handle->sbuf[st])
- != ICO_APF_RESOURCE_E_NONE) {
- apfw_warn("ico_apf_callback_websock: ico_apf_com_realsend Error");
- handle->shead = st;
- }
- if (handle->stail != handle->shead) {
- libwebsocket_callback_on_writable(handle->wsi_context,
- handle->wsi_connection);
- }
- }
+ pid, "\0", NULL, 0, handle);
break;
- case LWS_CALLBACK_CLIENT_RECEIVE:
- case LWS_CALLBACK_RECEIVE:
- msg = (char *)in;
- msg[len] = 0;
+ case ICO_UWS_EVT_RECEIVE:
+ msg = (char *)detail->_ico_uws_message.recv_data;
+ len = (int)detail->_ico_uws_message.recv_len;
if ((len <= 9) || (len >= (ICO_APF_RESOURCE_MSG_LEN+9))) {
- lws_callbacked --;
- apfw_warn("ico_apf_callback_websock: Receive Length Error, Len=%d", len);
- return 0;
+ uws_callbacked --;
+ apfw_warn("ico_apf_callback_uws: Receive Length Error, Len=%d", len);
+ return;
}
- apfw_trace("ico_apf_callback_websock: LWS_CALLBACK_RECEIVE[%s]", msg);
+ msg[len] = 0;
+ apfw_trace("ico_apf_callback_uws: ICO_UWS_EVT_RECEIVE[%s]", msg);
/* analize event code */
- if ((handle->type & ICO_APF_COM_TYPE_CONNECTION)
- == ICO_APF_COM_TYPE_SOUNDMGR) {
+ if ((handle->type & ICO_APF_COM_TYPE_CONNECTION) == ICO_APF_COM_TYPE_SOUNDMGR) {
/* Multi Sound Manager */
i = 0;
for (nparam = 0; nparam < 10; nparam++) {
param[nparam].end = i;
}
if (nparam <= 0) {
- lws_callbacked --;
- apfw_warn("ico_apf_callback_websock: Illegal Message Format(no param)");
- return 0;
+ uws_callbacked --;
+ apfw_warn("ico_apf_callback_uws: Illegal Message Format(no param)");
+ return;
}
for (cmd = ICO_APF_SOUND_COMMAND_CMD+1;
cmd <= ICO_APF_SOUND_COMMAND_MAX; cmd++) {
param[0].end - param[0].start) == 0) break;
}
if (cmd > ICO_APF_SOUND_COMMAND_MAX) {
- lws_callbacked --;
- apfw_warn("ico_apf_callback_websock: Receive Event Error(cmd=%d)", cmd);
- return 0;
+ uws_callbacked --;
+ apfw_warn("ico_apf_callback_uws: Receive Event Nop(cmd=%d)", cmd);
+ return;
}
res = ICO_APF_RESID_BASIC_SOUND;
pid = 0;
if (i < nparam) {
pid = strtol(&msg[param[i].start], (char **)0, 0);
if (ico_apf_get_app_id(pid, appid) != ICO_APP_CTL_E_NONE) {
- lws_callbacked --;
- apfw_trace("ico_apf_callback_websock: Unknown pid=%d", pid);
- return 0;
+ uws_callbacked --;
+ apfw_trace("ico_apf_callback_uws: Unknown pid=%d", pid);
+ return;
}
}
}
/* no need stream_state */
}
}
- apfw_trace("ico_apf_callback_websock: SoundMgr evt=%d res=%d(%s.%d) str=%s",
+ if (pid > 0) {
+ handle->pid = pid;
+ }
+ apfw_trace("ico_apf_callback_uws: SoundMgr evt=%d res=%d(%s.%d) str=%s",
cmd, res, appid, pid, strname);
/* save receive message to receive buffer */
ico_apf_put_recvmsg(cmd, res, pid, appid, strname, strlen, handle);
/* AppsController */
for (cmd = ICO_APF_RESOURCE_COMMAND_MIN;
cmd <= ICO_APF_RESOURCE_COMMAND_MAX; cmd++) {
- if (memcmp(msg,
- ico_apf_cmd_table[cmd-ICO_APF_RESOURCE_COMMAND_MIN], 3)
- == 0) break;
+ if (memcmp(msg, ico_apf_cmd_table[cmd-ICO_APF_RESOURCE_COMMAND_MIN], 3) == 0)
+ break;
}
if (cmd > ICO_APF_RESOURCE_COMMAND_MAX) {
- lws_callbacked --;
- apfw_warn("ico_apf_callback_appsctl: Receive Event Error(cmd=%d)", cmd);
- return 0;
+ uws_callbacked --;
+ apfw_warn("ico_apf_callback_appsctl: Receive Event Error(cmd=%d)",
+ cmd);
+ return;
}
for (res = ICO_APF_RESOURCE_RESID_MIN;
res <= ICO_APF_RESOURCE_RESID_MAX; res++) {
ico_apf_res_table[res-ICO_APF_RESOURCE_RESID_MIN], 4) == 0) break;
}
if (res > ICO_APF_RESOURCE_RESID_MAX) {
- lws_callbacked --;
- apfw_warn("ico_apf_callback_websock: Receive Resource Error(resid=%d)",
+ uws_callbacked --;
+ apfw_warn("ico_apf_callback_uws: Receive Resource Error(resid=%d)",
res);
- return 0;
+ return;
}
pid = 0;
pid = 0;
}
if (msg[st] == ' ') st++;
- apfw_trace("ico_apf_callback_websock: AppsCtl evt=%d res=%d pid=%d(%s) msg=%s",
+ if (pid > 0) {
+ handle->pid = pid;
+ }
+ apfw_trace("ico_apf_callback_uws: AppsCtl evt=%d res=%d pid=%d(%s) msg=%s",
cmd, res, pid, appid, &msg[st]);
/* save receive message to receive buffer */
ico_apf_put_recvmsg(cmd, res, pid, appid, &msg[st], len-st, handle);
}
break;
default:
- apfw_trace("ico_apf_callback_websock: UnKnown reason=%d", reason);
+ apfw_trace("ico_apf_callback_uws: UnKnown reason=%d", reason);
break;
}
- lws_callbacked --;
-
- return 0;
+ uws_callbacked --;
}
/*--------------------------------------------------------------------------*/
if (i <= 0) {
i = ICO_APF_RESOURCE_WSOCK_BUFR + i;
}
- if ((handle->stoprecv == 0) &&
- (i > ((ICO_APF_RESOURCE_WSOCK_BUFR * 3) / 4))) {
- /* request to stop sending if an opening is less than 25%. */
- handle->stoprecv = 1;
- apfw_trace("ico_apf_put_recvmsg: Flow Control(Stop) %d", i);
- libwebsocket_rx_flow_control(handle->wsi_connection, 0);
- }
+
ico_apf_poll_write_event(handle, 1);
}
p = p->next;
}
- apfw_trace("ico_apf_com_poll_fd_control: nfds=%d", nfds);
if (nfds > 0) {
+ apfw_trace("ico_apf_com_poll_fd_control: nfds=%d:%d[%x]",
+ nfds, fds[0]->fd, fds[0]->flags);
(*ico_apf_pollfd_func)(fds, nfds);
}
if (fds) free(fds);
int st;
ico_apf_com_handle_t *handle = (ico_apf_com_handle_t *)fd_ctl->apf_fd_control;
+ uifw_trace("ico_apf_com_poll_fd_event: handle=%08x fd=%d flags=%x",
+ (int)handle, handle ? handle->fd : 0, flags);
if (handle) {
- ico_apf_com_dispatch(handle, 0); /* try to service */
+ ico_apf_com_dispatch(handle); /* try to service */
}
else {
- ico_apf_com_dispatch(NULL, 0); /* try to service for server*/
+ ico_apf_com_dispatch(NULL); /* try to service for server*/
}
if (handle) {
/* send if send data exist */
if ((handle->stail != handle->shead) &&
- (handle->wsi_context != NULL) &&
- (handle->wsi_connection != NULL)) {
+ (handle->uws_context != NULL) &&
+ (handle->uws_id != NULL)) {
st = handle->shead;
if (handle->shead >= (ICO_APF_RESOURCE_WSOCK_BUFS-1)) {
handle->shead = 0;
!= ICO_APF_RESOURCE_E_NONE) {
apfw_warn("ico_apf_com_poll_fd_event: ico_apf_com_realsend Error");
handle->shead = st;
- ico_apf_com_dispatch(handle, 10); /* try to service */
- }
- if (handle->stail != handle->shead) {
- libwebsocket_callback_on_writable(handle->wsi_context,
- handle->wsi_connection);
+ ico_apf_com_dispatch(handle); /* try to service */
}
}
/* start/stop writable event */
if ((handle->stail == handle->shead) ||
- (handle->wsi_context == NULL) ||
- (handle->wsi_connection == NULL)) {
+ (handle->uws_context == NULL) ||
+ (handle->uws_id == NULL)) {
ico_apf_poll_write_event(handle, 0);
}
else {
- libwebsocket_callback_on_writable(handle->wsi_context,
- handle->wsi_connection);
ico_apf_poll_write_event(handle, 1);
}
}
#include <sys/time.h>
#include <Ecore.h>
-#include <libwebsockets.h>
#include "ico_apf_private.h"
#include "ico_apf_ecore.h"
* ... reply of #get_stream_list# (no stream)
*/
-/* Protocol name on libwebsockets for Application Manager */
+/* Protocol name on communication for Application Manager */
#define ICO_PROTOCOL_APPSCONTROLLER "ico_apps_controller"
-/* Protocol name on libwebsockets for Pulse-Audio Plugin(Multi Sound Manager)*/
+/* Protocol name on communication for Pulse-Audio Plugin(Multi Sound Manager)*/
#define ICO_PROTOCOL_MULTISOUNDMANAGER "ico_soundmgr-protocol"
/* AppsController resource control command and event */
ico_apf_com_poll_t *poll; /* poll table */
int pid; /* client pid (server only) */
- struct libwebsocket_context *wsi_context;
- /* Context of libwebsockets */
- struct libwebsocket *wsi_connection;/* WSI of libwebsockets */
+ struct ico_uws_context *uws_context;/* Context of comminucation */
+ void *uws_id; /* Communication Id */
short retry; /* Retry counter */
- short stoprecv; /* Receive stopped(flow control) */
+ short res; /* (unused) */
unsigned short shead; /* Head position of send datas */
unsigned short stail; /* Tail position of send datas */
ico_apf_com_buffer_t *sbuf[ICO_APF_RESOURCE_WSOCK_BUFS];
ico_apf_com_eventlistener listener,
void *user_data);
int ico_apf_com_removeeventlistener(ico_apf_com_handle_t *handle);
-void ico_apf_com_dispatch(ico_apf_com_handle_t *handle, const int timeoutms);
+void ico_apf_com_dispatch(ico_apf_com_handle_t *handle);
/* API for file descriptor poll */
int ico_apf_com_poll_fd_control(ico_apf_com_pollfd_cb poll_fd_cb);
/*==============================================================================*/
/* define */
/*==============================================================================*/
-#define APP_CONF_AIL_NULL_STR "(null)"
+#define APP_CONF_AIL_NULL_STR "(NULL)"
#define APP_CONF_EVENT_OK (0)
#define APP_CONF_EVENT_FAIL (1)
static Ico_Uxf_App_Config *_ico_app_config_update = NULL;
static Ico_Uxf_Sys_Config *sys_config = NULL;
static GKeyFile *sappfile = NULL;
+static char *default_icon = NULL;
static pkgmgr_client *conf_pc = NULL;
static conf_pkgmgr_event_t *conf_prog_event = NULL;
/* get package name for appid */
ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
- if (strcmp(package, APP_CONF_AIL_NULL_STR) == 0) {
+ if (strcasecmp(package, APP_CONF_AIL_NULL_STR) == 0) {
package = NULL;
}
/* get icon path */
ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icon);
- if (strcmp(icon, APP_CONF_AIL_NULL_STR) == 0) {
+ if (strcasecmp(icon, APP_CONF_AIL_NULL_STR) == 0) {
icon = NULL;
}
- else if (icon != NULL) {
- /* file check */
- memset(&buff, 0, sizeof(buff));
- if (stat(icon, &buff) == 0) {
- if (S_ISDIR(buff.st_mode)) {
- /* is directory */
- icon = NULL;
- }
- }
- else {
- /* is not exist */
- icon = NULL;
- }
+ if ((icon == NULL) || (*icon == 0)) {
+ icon = default_icon;
}
/* get name */
ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name);
- if (strcmp(name, APP_CONF_AIL_NULL_STR) == 0) {
+ if (strcasecmp(name, APP_CONF_AIL_NULL_STR) == 0) {
name = NULL;
}
/* get category */
ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &category);
- if (strcmp(category, APP_CONF_AIL_NULL_STR) != 0) {
+ if (strcasecmp(category, APP_CONF_AIL_NULL_STR) != 0) {
apfw_trace("infoAilpkg: %s + %s", add_category, category);
strncpy(&add_category[add_category_len],
category, sizeof(add_category)-add_category_len-1);
/* get type */
ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &type);
- if (strcmp(type, APP_CONF_AIL_NULL_STR) == 0) {
- type = NULL;
- }
/* get exec */
ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exec);
- if (strcmp(exec, APP_CONF_AIL_NULL_STR) == 0) {
+ if (strcasecmp(exec, APP_CONF_AIL_NULL_STR) == 0) {
exec = NULL;
}
apptbl = &_ico_app_config_update->application[_ico_app_config_update->applicationNum];
apptbl->appid = strdup(package);
if (icon) {
- apptbl->icon_key_name = strdup(icon);
+ if ((stat(icon, &buff) == 0) &&
+ (! S_ISDIR(buff.st_mode))) {
+ apptbl->icon_key_name = strdup(icon);
+ }
+ else {
+ apptbl->icon_key_name = "\0";
+ }
}
else {
- apptbl->icon_key_name = strdup("\0");
+ apptbl->icon_key_name = "\0";
}
if ((name != NULL) && (*name != 0)) {
apptbl->name = strdup(name);
else {
apptbl->name = strdup(package);
}
+ if (strcasecmp(type, APP_CONF_AIL_NULL_STR) == 0) {
+ apptbl->type = NULL;
+ }
+ else {
+ apptbl->type = strdup(type);
+ }
/* set default values */
apptbl->hostId = sys_config->misc.default_hostId;
apptbl->invisiblecpu = 100;
/* get NoDisplay */
- if ((icon != NULL) && (*icon != 0)) {
+ if ((apptbl->icon_key_name != NULL) && (*apptbl->icon_key_name != 0)) {
bval = false;
ail_appinfo_get_bool(appinfo, AIL_PROP_NODISPLAY_BOOL, &bval);
apptbl->noicon = (int)bval;
if (found > 1) {
apfw_error("infoAilpkg: [%s] unknown category", work);
}
+ /* find type */
+ if (found == 0) {
+ if (strncasecmp(work, "type=", 5) == 0) {
+ found = 1;
+ if (apptbl->type) {
+ free(apptbl->type);
+ }
+ apptbl->type = strdup(&work[5]);
+ }
+ }
/* find display */
if ((found == 0) &&
(strncasecmp(work, "display", 7) == 0)) {
}
}
apptbl->exec = strdup(exec);
- apptbl->type = strdup(type);
if (apptbl->displayzoneNum == 0) {
apptbl->displayzoneNum = 1;
apptbl->display[0].displayId = sys_config->misc.default_displayId;
apptbl->sound[0].soundId = sys_config->misc.default_soundId;
apptbl->sound[0].zoneId = sys_config->misc.default_soundzoneId;
}
- apfw_trace("Ail.%d: appid=%s name=%s exec=%s type=%s",
+ apfw_trace("Ail.%d: appid=%s name=%s exec=%s icon=%s type=%s",
_ico_app_config_update->applicationNum, apptbl->appid, apptbl->name,
- apptbl->exec, apptbl->type);
+ apptbl->exec, apptbl->icon_key_name, apptbl->type);
apfw_trace("Ail.%d: categ=%d kind=%d disp=%d layer=%d zone=%d "
"sound=%d zone=%d auto=%d noicon=%d anim=%s.%d overlap=%d cpu=%d",
_ico_app_config_update->applicationNum, apptbl->categoryId, apptbl->kindId,
apptbl->animation_time, apptbl->menuoverlap, apptbl->invisiblecpu);
_ico_app_config_update->applicationNum++;
}
- else {
- }
if (_ico_app_config_update->applicationNum > num)
return AIL_CB_RET_CANCEL;
GString* filepath = g_string_new("xx");
g_string_printf(filepath, "%s/%s", sys_config->misc.confdir, ICO_UXF_CONFIG_APPATTR);
- if (! g_key_file_load_from_file(sappfile, filepath->str,
- G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
- &error)) {
+ if (g_key_file_load_from_file(sappfile, filepath->str,
+ G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
+ &error)) {
+ error = NULL;
+ default_icon = g_key_file_get_string(sappfile, "app-icon", "default-icon", &error);
+ if (error != NULL) {
+ g_clear_error(&error);
+ default_icon = NULL;
+ }
+ }
+ else {
apfw_error("readAilApplist: %s %s", (char *)filepath->str, error->message);
g_key_file_free(sappfile);
sappfile = NULL;
zone->id = j;
zone->zoneidx = zoneidx++;
zone->display = display;
+ zone->node = ICO_UXF_NODEDISP_2_NODEID(display->hostId, display->displayno);
if (zonesizes[j] <= 0) continue;
for (j = 0; j < dispzone_length; j++) {
if (zonelists[j]) g_strfreev(zonelists[j]);
zone = &(display->zone[j]);
- apfw_trace("Disp.%d zone.%d x/y = %d/%d w/h = %d/%d over = %d.%d %d %d %d %d",
- i, j, zone->x, zone->y, zone->width, zone->height,
+ apfw_trace("Disp.%d zone.%d node=%x x/y=%d/%d w/h=%d/%d over=%d.%d %d %d %d %d",
+ i, j, zone->node, zone->x, zone->y, zone->width, zone->height,
zone->overlapNum, zone->overlap[0], zone->overlap[1],
zone->overlap[2], zone->overlap[3], zone->overlap[4]);
}
inputdev->inputsw[j].name = strdup((char *)swlist[0]);
if (swsize > 1) {
inputdev->inputsw[j].appid = strdup((char *)swlist[1]);
+ if (swsize > 2) {
+ inputdev->inputsw[j].keycode = strtol((char *)swlist[2],
+ (char **)0, 0);
+ }
}
}
g_strfreev(swlist);
- uifw_trace("reloadSysConfig: input %s.%s app = %s",
+ uifw_trace("Input %s.%s app = %s key=%d",
inputdev->name,
inputdev->inputsw[j].name ? inputdev->inputsw[j].name : " ",
- inputdev->inputsw[j].appid ? inputdev->inputsw[j].appid : " ");
+ inputdev->inputsw[j].appid ? inputdev->inputsw[j].appid : " ",
+ inputdev->inputsw[j].keycode);
}
g_string_free(sw_key,TRUE);
}
static void ico_uxf_output_modecb(void *data, struct wl_output *wl_output,
uint32_t flags, int32_t width, int32_t height,
int32_t refresh);
+static void ico_uxf_create_window(uint32_t surfaceid, const char *appid, uint32_t node,
+ uint32_t layer, int32_t x, int32_t y,
+ int32_t width, int32_t height);
/* ico_window_mgr(Multi Window Manager) callback functions */
struct ico_window;
static void ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, int32_t pid, const char *appid);
+ uint32_t surfaceid, const char *winname, int32_t pid,
+ const char *appid);
+static void ico_uxf_window_namecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t surfaceid, const char *winname);
static void ico_uxf_window_destroyedcb(void *data, struct ico_window_mgr *ico_window_mgr,
uint32_t surfaceid);
static void ico_uxf_window_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
uint32_t surfaceid, int32_t visible, int32_t raise,
int32_t hint);
static void ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, const char *appid,
- int32_t layer, int32_t x, int32_t y,
+ uint32_t surfaceid, uint32_t node,
+ uint32_t layer, int32_t x, int32_t y,
int32_t width, int32_t height, int32_t hint);
-static void ico_uxf_window_activecb(void *data,
- struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid,
- uint32_t active);
+static void ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t surfaceid, int32_t active);
+static void ico_uxf_window_layer_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t layer, int32_t visible);
+static void ico_uxf_window_surfacecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ const char *appid, struct wl_array *surfaces);
+static void ico_uxf_window_mapcb(void *data, struct ico_window_mgr *ico_window_mgr,
+ int32_t event, uint32_t surfaceid, int32_t width,
+ int32_t height, int32_t stride, int32_t format);
/* ico_input_mgr(Multi Input Manager) callback functions */
static void ico_uxf_input_capabilitiescb(void *data, struct ico_exinput *ico_exinput,
/* Window Manger Interface */
static const struct ico_window_mgr_listener windowlistener = {
ico_uxf_window_createdcb,
+ ico_uxf_window_namecb,
ico_uxf_window_destroyedcb,
ico_uxf_window_visiblecb,
ico_uxf_window_configurecb,
- ico_uxf_window_activecb
+ ico_uxf_window_activecb,
+ ico_uxf_window_layer_visiblecb,
+ ico_uxf_window_surfacecb,
+ ico_uxf_window_mapcb
};
/* Input Manger Interface */
dsp = ico_uxf_mng_display(gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, 0);
- uifw_trace("ico_uxf_init: App.%d MainDisplay.%d %08x",
+ uifw_trace("ico_uxf_init: App.%s MainDisplay.%d %08x",
gIco_Uxf_Api_Mng.Mng_MyProcess->attr.process,
gIco_Uxf_Api_Mng.Mng_MyProcess->attr.mainwin.display, dsp);
- for (ret = 0; ret < (5000/50); ret++) {
+ for (ret = 0; ret < (2000/50); ret++) {
gIco_Uxf_Api_Mng.Wayland_Display = wl_display_connect(NULL);
if (gIco_Uxf_Api_Mng.Wayland_Display) break;
usleep(50*1000);
}
+ if (! gIco_Uxf_Api_Mng.Wayland_Display) {
+ uifw_error("ico_uxf_init:Can not connect to wayland, Abort!!");
+ fprintf(stderr, "ico_uxf_init:Can not connect to wayland, Abort!!\n");
+ exit(1);
+ }
gIco_Uxf_Api_Mng.Wayland_Registry
= wl_display_get_registry(gIco_Uxf_Api_Mng.Wayland_Display);
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
uifw_trace("ico_uxf_init: Wayland/Weston connect OK");
- /* set client attribute if need */
- if (gIco_Uxf_Api_Mng.Wayland_WindowMgr) {
- for(dn = 0; dn < appconf->applicationNum; dn++) {
- if (appconf->application[dn].noconfigure) {
- uifw_trace("ico_uxf_init: %s no need configure event",
- appconf->application[dn].appid);
- ico_window_mgr_set_client_attr(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
- appconf->application[dn].appid,
- ICO_WINDOW_MGR_CLIENT_ATTR_NOCONFIGURE, 1);
- wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
- }
- }
- }
-
gIco_Uxf_Api_Mng.WaylandFd
= wl_display_get_fd(gIco_Uxf_Api_Mng.Wayland_Display);
ico_uxf_free_eventque(freeeq);
/* flush wayland connection */
- ico_window_mgr_set_eventcb(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
+ ico_window_mgr_declare_manager(gIco_Uxf_Api_Mng.Wayland_WindowMgr, 1);
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
/* application launch/dead callback from AppCore(aul) */
wl_registry_bind(registry, name, &ico_window_mgr_interface, 1);
ico_window_mgr_add_listener(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
&windowlistener, NULL);
- ico_window_mgr_set_user(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
- getpid(), gIco_Uxf_Api_Mng.MyProcess);
}
else if (strcmp(interface, "ico_exinput") == 0) {
/* regist exinput */
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_uxf_create_window: Create/Set Window management table(static function)
+ *
+ * @param[in] surfaceid ico_window_mgr surface Id
+ * @param[in] appid client application Id
+ * @param[in] node surface node Id
+ * @param[in] layer surface layer
+ * @param[in] x surface upper-left X coodinate
+ * @param[in] y surface upper-left Y coodinate
+ * @param[in] width surface width
+ * @param[in] height surface height
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_uxf_create_window(uint32_t surfaceid, const char *appid, uint32_t node, uint32_t layer,
+ int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ Ico_Uxf_Mng_Window *win;
+ Ico_Uxf_Mng_EventQue *que;
+ int display;
+ Ico_Uxf_Mng_Process *prc;
+
+ ico_uxf_enter_critical();
+
+ win = ico_uxf_mng_window(surfaceid, 0);
+
+ if (! win) {
+ win = ico_uxf_mng_window(surfaceid, 1);
+ win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
+ }
+ display = ICO_UXF_SURFACEID_2_NODEID(surfaceid);
+ win->mng_display = ico_uxf_mng_display(display, 0);
+ win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
+ win->attr.display = display;
+ win->attr.layer = layer;
+ memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
+ strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
+ win->attr.node = node;
+ win->attr.x = x;
+ win->attr.y = y;
+ win->attr.w = width;
+ win->attr.h = height;
+
+ prc = ico_uxf_mng_process(appid, 0);
+ win->mng_process = prc;
+ if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
+ /* sub-window */
+ win->attr.subwindow = 1;
+ }
+
+ if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW) {
+
+ que = ico_uxf_alloc_eventque();
+
+ que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
+ que->detail.window.display = display;
+ que->detail.window.window = surfaceid;
+ que->detail.window.layer = layer;
+ que->detail.window.x = win->attr.x;
+ que->detail.window.y = win->attr.y;
+ que->detail.window.w = win->attr.w;
+ que->detail.window.h = win->attr.h;
+ que->detail.window.visible = win->attr.visible;
+ que->detail.window.raise = win->attr.raise;
+ que->detail.window.active = win->attr.active;
+
+ ico_uxf_regist_eventque(que);
+ }
+ ico_uxf_leave_critical();
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ico_uxf_window_createdcb: wayland surface create callback(static function)
*
* @param[in] data user data(unused)
* @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
* @param[in] surfaceid ico_window_mgr surface Id
+ * @param[in] winname surface window name(title)
* @param[in] pid wayland client process Id
* @param[in] appid wayland client application Id
* @return none
/*--------------------------------------------------------------------------*/
static void
ico_uxf_window_createdcb(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, int32_t pid, const char *appid)
+ uint32_t surfaceid, const char *winname, int32_t pid,
+ const char *appid)
{
Ico_Uxf_Mng_Process *prc;
Ico_Uxf_Mng_ProcWin *ppwin;
Ico_Uxf_Mng_ProcWin *ppw;
- uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x pid=%d appid=%s myapp=%s)",
- (int)surfaceid, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
+ uifw_trace("ico_uxf_window_createdcb: Enter(surf=%08x name=%s pid=%d appid=%s myapp=%s)",
+ (int)surfaceid, winname, pid, appid, gIco_Uxf_Api_Mng.MyProcess);
prc = ico_uxf_mng_process(appid, 0);
if (prc) {
if (((Ico_Uxf_conf_application *)prc->appconf)->animation) {
ico_window_mgr_set_animation(
gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
+ ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE|ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW|
+ ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
((Ico_Uxf_conf_application *)prc->appconf)->animation,
((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
}
else if (((Ico_Uxf_conf_application *)prc->appconf)->animation_time > 0) {
ico_window_mgr_set_animation(
- gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid, " ",
- ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
+ gIco_Uxf_Api_Mng.Wayland_WindowMgr, surfaceid,
+ ICO_WINDOW_MGR_ANIMATION_TYPE_HIDE|ICO_WINDOW_MGR_ANIMATION_TYPE_SHOW|
+ ICO_WINDOW_MGR_ANIMATION_TYPE_MOVE,
+ " ", ((Ico_Uxf_conf_application *)prc->appconf)->animation_time);
}
}
if (prc->attr.mainwin.window <= 0) {
uifw_trace("ico_uxf_window_createdcb: Set Main Window, Config Data");
prc->attr.mainwin.window = surfaceid;
- ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
- prc->attr.mainwin.layer, prc->attr.mainwin.x,
- prc->attr.mainwin.y, prc->attr.mainwin.w,
- prc->attr.mainwin.h, 0);
+ ico_uxf_create_window(surfaceid, appid, prc->attr.mainwin.node,
+ prc->attr.mainwin.layer, prc->attr.mainwin.x,
+ prc->attr.mainwin.y, prc->attr.mainwin.w,
+ prc->attr.mainwin.h);
if (gIco_Uxf_Api_Mng.Hook_Window) {
(*gIco_Uxf_Api_Mng.Hook_Window)(prc->attr.process, surfaceid,
ICO_UXF_HOOK_WINDOW_CREATE_MAIN);
}
else {
uifw_trace("ico_uxf_window_createdcb: Sub Window, Dummy Data");
- ico_uxf_window_configurecb(data, ico_window_mgr, surfaceid, appid,
- prc->attr.mainwin.layer, 16384, 16384, 1, 1, 0);
+ ico_uxf_create_window(surfaceid, appid, prc->attr.mainwin.node,
+ prc->attr.mainwin.layer, ICO_UXF_MAX_COORDINATE,
+ ICO_UXF_MAX_COORDINATE, 1, 1);
ppwin = (Ico_Uxf_Mng_ProcWin *)malloc(sizeof(Ico_Uxf_Mng_ProcWin));
if (ppwin) {
memset(ppwin, 0, sizeof(Ico_Uxf_Mng_ProcWin));
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_uxf_window_namecb: wayland change surface name callback(static function)
+ *
+ * @param[in] data user data(unused)
+ * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
+ * @param[in] surfaceid ico_window_mgr surface Id
+ * @param[in] winname surface window name(title)
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_uxf_window_namecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t surfaceid, const char *winname)
+{
+ uifw_trace("ico_uxf_window_namecb: surf=%08x name=%s, NOP", (int)surfaceid, winname);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ico_uxf_window_destroyedcb: wayland surface destroy callback(static function)
*
* @param[in] data user data(unused)
* @param[in] data user data(unused)
* @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
* @param[in] surfaceid ico_window_mgr surface Id
- * @param[in] visibility surface visible(1=visible/0=unvisible/9=nochange)
- * @param[in] raise surface raise(1=raise/0=lower/9=nochange)
+ * @param[in] visible surface visible(1=visible/0=unvisible/other=nochange)
+ * @param[in] raise surface raise(1=raise/0=lower/other=nochange)
* @param[in] hint client request(1=client request(not changed)/0=changed)
* @return none
*/
* @param[in] data user data(unused)
* @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
* @param[in] surfaceid ico_window_mgr surface Id
- * @param[in] appid client application Id
+ * @param[in] node surface node Id
* @param[in] x surface upper-left X coodinate
* @param[in] y surface upper-left Y coodinate
* @param[in] width surface width
/*--------------------------------------------------------------------------*/
static void
ico_uxf_window_configurecb(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, const char *appid, int32_t layer,
- int32_t x, int32_t y, int32_t width, int32_t height,
- int32_t hint)
+ uint32_t surfaceid, uint32_t node,
+ uint32_t layer, int32_t x, int32_t y,
+ int32_t width, int32_t height, int32_t hint)
{
Ico_Uxf_Mng_Window *win;
Ico_Uxf_Mng_EventQue *que;
- int display;
- Ico_Uxf_Mng_Process *prc;
#if 0 /* too many logout, change to comment out */
- uifw_trace("ico_uxf_window_configurecb: surf=%08x app=%s layer=%d "
+ uifw_trace("ico_uxf_window_configurecb: surf=%08x node=%x layer=%x "
"x/y=%d/%d w/h=%d/%d hint=%d",
- (int)surfaceid, appid, layer, x, y, width, height, hint);
+ (int)surfaceid, node, layer, x, y, width, height, hint);
#endif /* too many logout, change to comment out */
ico_uxf_enter_critical();
win = ico_uxf_mng_window(surfaceid, 0);
if (!win) {
- win = ico_uxf_mng_window(surfaceid, 1);
- display = ICO_UXF_GETDISPLAYID(surfaceid);
- win->mng_display = ico_uxf_mng_display(display, 0);
- win->mng_layer = ico_uxf_mng_layer(display, layer, 0);
- win->attr.eventmask = ICO_UXF_EVENT_NEWWINDOW;
- win->attr.display = display;
- win->attr.layer = layer;
- memset(win->attr.process, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
- strncpy(win->attr.process, appid, ICO_UXF_MAX_PROCESS_NAME);
- win->attr.x = x;
- win->attr.y = y;
- win->attr.w = width;
- win->attr.h = height;
- hint = 0;
-
- prc = ico_uxf_mng_process(appid, 0);
- win->mng_process = prc;
- if ((prc != NULL) && (prc->attr.mainwin.window != (int)surfaceid)) {
- /* sub-window */
- win->attr.subwindow = 1;
- }
-
- if (gIco_Uxf_Api_Mng.EventMask & ICO_UXF_EVENT_NEWWINDOW) {
-
- que = ico_uxf_alloc_eventque();
-
- que->detail.event = ICO_UXF_EVENT_NEWWINDOW;
- que->detail.window.display = display;
- que->detail.window.window = surfaceid;
- que->detail.window.layer = layer;
- que->detail.window.x = win->attr.x;
- que->detail.window.y = win->attr.y;
- que->detail.window.w = win->attr.w;
- que->detail.window.h = win->attr.h;
- que->detail.window.visible = win->attr.visible;
- que->detail.window.raise = win->attr.raise;
- que->detail.window.active = win->attr.active;
-
- ico_uxf_regist_eventque(que);
- }
+ uifw_error("ico_uxf_window_configurecb: Unknown surface Id(%08x)", (int)surfaceid);
}
else {
- if ((win->attr.layer != layer) ||
+ if ((win->attr.layer != (int)layer) ||
(win->attr.x != x) || (win->attr.y != y) ||
(win->attr.w != width) || (win->attr.h != height)) {
win->attr.y = y;
win->attr.w = width;
win->attr.h = height;
- if (win->attr.layer != layer) {
+ if (win->attr.layer != (int)layer) {
win->attr.layer = layer;
win->mng_layer = ico_uxf_mng_layer(win->mng_display->attr.display,
layer, 0);
/*--------------------------------------------------------------------------*/
static void
ico_uxf_window_activecb(void *data, struct ico_window_mgr *ico_window_mgr,
- uint32_t surfaceid, uint32_t active)
+ uint32_t surfaceid, int32_t active)
{
Ico_Uxf_Mng_Window *win;
Ico_Uxf_Mng_EventQue *que;
que = ico_uxf_alloc_eventque();
que->detail.event = ICO_UXF_EVENT_ACTIVEWINDOW;
- que->detail.window.display = ICO_UXF_GETDISPLAYID(surfaceid);
+ que->detail.window.display = ICO_UXF_SURFACEID_2_NODEID(surfaceid);
que->detail.window.window = surfaceid;
- que->detail.window.active = active;
- win->attr.active = active;
-
+ if (active == ICO_WINDOW_MGR_ACTIVE_SELECTED) {
+ que->detail.window.active = ICO_UXF_WINDOW_SELECT;
+ win->attr.active = ICO_UXF_WINDOW_POINTER_ACTIVE |
+ ICO_UXF_WINDOW_KEYBOARD_ACTIVE;
+ }
+ else {
+ que->detail.window.active = 0;
+ if (active & ICO_WINDOW_MGR_ACTIVE_POINTER) {
+ que->detail.window.active |= ICO_UXF_WINDOW_POINTER_ACTIVE;
+ }
+ if (active & ICO_WINDOW_MGR_ACTIVE_KEYBOARD) {
+ que->detail.window.active |= ICO_UXF_WINDOW_KEYBOARD_ACTIVE;
+ }
+ win->attr.active = que->detail.window.active;
+ }
ico_uxf_regist_eventque(que);
}
}
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_uxf_window_layer_visiblecb: wayland layer visible callback(static function)
+ *
+ * @param[in] data user data(unused)
+ * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
+ * @param[in] layer layer Id
+ * @param[in] visible layer visible(1=visible/0=unvisible/other=nochange)
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_uxf_window_layer_visiblecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ uint32_t layer, int32_t visible)
+{
+ uifw_trace("ico_uxf_window_layer_visiblecb: layer=%x visible=%d, NOP", layer, visible);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief ico_uxf_window_surfacecb: query applicationsurface callback(static function)
+ *
+ * @param[in] data user data(unused)
+ * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
+ * @param[in] appid application Id
+ * @param[in] suface surface Id array
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_uxf_window_surfacecb(void *data, struct ico_window_mgr *ico_window_mgr,
+ const char *appid, struct wl_array *surfaces)
+{
+ uifw_trace("ico_uxf_window_surfacecb: appid=%s, NOP", appid);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief ico_uxf_window_mapcb: surface map event callback(static function)
+ *
+ * @param[in] data user data(unused)
+ * @param[in] ico_window_mgr wayland ico_window_mgr plugin interface
+ * @param[in] event event
+ * @param[in] surfaceid surface Id
+ * @param[in] width surface width
+ * @param[in] height surface height
+ * @param[in] stride surface buffer(frame buffer) stride
+ * @param[in] format surface buffer format
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_uxf_window_mapcb(void *data, struct ico_window_mgr *ico_window_mgr,
+ int32_t event, uint32_t surfaceid, int32_t width,
+ int32_t height, int32_t stride, int32_t format)
+{
+ uifw_trace("ico_uxf_window_mapcb: surf=%08x event=%d w/h/s/f=%d/%d/%d/%d",
+ (int)surfaceid, event, width, height, stride, format);
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ico_uxf_input_capabilitiescb: wayland extended input
* input capabilities callback(static function)
*
sysconf->inputdev[i].inputsw[j].appid);
ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr,
sysconf->inputdev[i].inputsw[j].appid,
- inputdev->device, inputsw->input, 1);
+ inputdev->device, inputsw->input, 1,
+ sysconf->inputdev[i].inputsw[j].keycode);
inputsw->fix = 1;
break;
}
proc->attr.internalid, proc->showmode);
ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
proc->attr.mainwin.window,
- proc->showmode ==
- ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION ?
- ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION :
- ICO_WINDOW_MGR_VISIBLE_SHOW,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ICO_WINDOW_MGR_VISIBLE_SHOW,
+ ICO_WINDOW_MGR_V_NOCHANGE,
+ (proc->showmode != 0) ?
+ ICO_WINDOW_MGR_ANIMATION_ANIMATION :
+ ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
}
}
* @param[in] appid target application id
* @param[in] device target input device name
* @param[in] input target input switch number
+ * @param[in] keycode emulated keyboard key-code
* @return result status
* @retval ICO_UXF_EOK success(cullentry always success)
*/
/*--------------------------------------------------------------------------*/
ICO_APF_API int
-ico_uxf_input_control(const int add, const char *appid, const char *device, const int input)
+ico_uxf_input_control(const int add, const char *appid,
+ const char *device, const int input, const int keycode)
{
- apfw_trace("ico_uxf_input_control: input switch %s %s %s.%d",
+ apfw_trace("ico_uxf_input_control: input switch %s %s %s.%d(%d)",
add ? "add" : "del", appid ? appid : "all-app",
- device ? device : "all-device", input);
+ device ? device : "all-device", input, keycode);
if (add) {
ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,
- device, input, 0);
+ device, input, 0, keycode);
}
else {
ico_input_mgr_control_del_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,
{
Ico_Uxf_Mng_Process *proc; /* process management table */
int hash;
- Ico_Uxf_conf_application *apptbl = NULL;
uifw_trace("ico_uxf_process_execute: Enter(%s)", name);
if (proc->attr.internalid < 0) {
uifw_error("ico_uxf_process_execute: Leave(ENOSYS), Launch App Error(%d)",
proc->attr.internalid);
+ proc->attr.status = ICO_UXF_PROCSTATUS_STOP;
return ICO_UXF_ENOSYS;
}
/* macro */
/* get DisplayId from SurfaceId */
#define ICO_UXF_GETDISPLAYID(surfaceid) \
- ((surfaceid >> 20) & 0x0fff)
+ ((surfaceid >> 16) & 0x00ff)
/* define struct */
/* struct management callback function */
/* update a process management table */
void ico_uxf_free_procwin(Ico_Uxf_Mng_Process *prc);
/* release application windows */
+#define ICO_UXF_WITHANIMA 0x0100 /* with animation */
void ico_uxf_window_visible_control(Ico_Uxf_Mng_Window *winmng,
const int show, const int raise);
/* Window visible and cpu control */
* @brief ico_uxf_window_visible_control: window visible control(internal function)
*
* @param[in] winmng process management table
- * @param[in] show show(1)/hide(0)/nochange(9)
- * @param[in] raise raise(1)/lower(0)/nochange(9)
+ * @param[in] show show(1)/hide(0)/nochange(other)
+ * @param[in] raise raise(1)/lower(0)/nochange(other)
* @return none
*/
/*--------------------------------------------------------------------------*/
{
int showshow = show & 0x0ffff;
- uifw_trace("ico_uxf_window_visible_control: send visible to weston(%s,%08x,%d,%d)",
+ uifw_trace("ico_uxf_window_visible_control: send visible to weston(%s,%08x,%x,%d)",
(winmng->mng_process)->attr.process, winmng->attr.window, showshow, raise);
- if ((showshow == ICO_WINDOW_MGR_VISIBLE_SHOW) ||
- (showshow == ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION)) {
+ if ((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_SHOW) {
if (((winmng->mng_process)->attr.invisiblecpu == 0) &&
((winmng->mng_process)->attr.suspend != 0)) {
kill((winmng->mng_process)->attr.internalid, SIGCONT);
uifw_trace("ico_uxf_window_visible_control: CPU resume(%s)",
(winmng->mng_process)->attr.process);
- if (raise != ICO_WINDOW_MGR_RAISE_NOCHANGE) {
+ if ((raise == ICO_WINDOW_MGR_RAISE_RAISE) ||
+ (raise == ICO_WINDOW_MGR_RAISE_LOWER)) {
ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
winmng->attr.window,
- ICO_WINDOW_MGR_VISIBLE_NOCHANGE, raise);
+ ICO_WINDOW_MGR_V_NOCHANGE, raise,
+ ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
if ((show & 0x00010000) == 0) {
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
}
return;
}
}
- else if (((winmng->mng_process)->showmode ==
- ICO_WINDOW_MGR_VISIBLE_SHOW) ||
- ((winmng->mng_process)->showmode ==
- ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION)) {
+ else if (((winmng->mng_process)->showmode & (~ICO_UXF_WITHANIMA)) ==
+ ICO_WINDOW_MGR_VISIBLE_SHOW) {
return;
}
}
/* send visible control to Weston(Multi Window Manager) */
ico_window_mgr_set_visible(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
- winmng->attr.window, showshow, raise);
+ winmng->attr.window, showshow & (~ICO_UXF_WITHANIMA), raise,
+ (showshow & ICO_UXF_WITHANIMA) ?
+ ICO_WINDOW_MGR_ANIMATION_ANIMATION :
+ ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
if ((show & 0x00010000) == 0) {
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
}
- if (((showshow == ICO_WINDOW_MGR_VISIBLE_HIDE) ||
- (showshow == ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION)) &&
+ if (((showshow & (~ICO_UXF_WITHANIMA)) == ICO_WINDOW_MGR_VISIBLE_HIDE) &&
((winmng->mng_process)->attr.invisiblecpu == 0) &&
((winmng->mng_process)->attr.suspend == 0)) {
/* change to hide, application suspend */
(winmng->mng_process)->attr.process);
}
else {
- (winmng->mng_process)->showmode = -1;
+ (winmng->mng_process)->showmode = 0xff;
(winmng->mng_process)->susptimer = 0;
}
}
winmng->attr.h = h;
ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
- ICO_UXF_MAX_COORDINATE, ICO_UXF_MAX_COORDINATE,
- winmng->attr.w, winmng->attr.h);
+ winmng->attr.node,
+ ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
+ winmng->attr.w, winmng->attr.h,
+ ICO_WINDOW_MGR_ANIMATION_NOANIMATION);
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
uifw_trace("ico_uxf_window_resize: Leave(EOK)");
* @param[in] window window Id(same as ico_window_mgr surface Id)
* @param[in] x window upper-left X coodinate of display
* @param[in] y window upper-left Y coodinate of display
+ * @param[in] animation move with animation(=1)/no animation(=0)
* @return result
* @retval ICO_UXF_EOK success
* @retval ICO_UXF_ESRCH error(not initialized)
*/
/*--------------------------------------------------------------------------*/
ICO_APF_API int
-ico_uxf_window_move(const int window, const int x, const int y)
+ico_uxf_window_move(const int window, const int x, const int y, const int animation)
{
Ico_Uxf_Mng_Window *winmng;
- uifw_trace("ico_uxf_window_move: Enter(%08x,%d,%d)", window, x, y);
+ uifw_trace("ico_uxf_window_move: Enter(%08x,%d,%d,%d)", window, x, y, animation);
if(gIco_Uxf_Api_Mng.Initialized <= 0) {
uifw_warn("ico_uxf_window_move: Leave(ESRCH)");
winmng->attr.y = y;
ico_window_mgr_set_positionsize(gIco_Uxf_Api_Mng.Wayland_WindowMgr, window,
- winmng->attr.x, winmng->attr.y,
- ICO_UXF_MAX_COORDINATE, ICO_UXF_MAX_COORDINATE);
+ winmng->attr.node, winmng->attr.x, winmng->attr.y,
+ ICO_WINDOW_MGR_V_NOCHANGE, ICO_WINDOW_MGR_V_NOCHANGE,
+ (animation == 0) ?
+ ICO_WINDOW_MGR_ANIMATION_NOANIMATION :
+ ICO_WINDOW_MGR_ANIMATION_ANIMATION);
wl_display_flush(gIco_Uxf_Api_Mng.Wayland_Display);
uifw_trace("ico_uxf_window_move: Leave(EOK)");
return ICO_UXF_ENOENT;
}
- ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_NOCHANGE,
+ ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
ICO_WINDOW_MGR_RAISE_RAISE);
uifw_trace("ico_uxf_window_raise: Leave(EOK)");
return ICO_UXF_ENOENT;
}
- ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_NOCHANGE,
+ ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_V_NOCHANGE,
ICO_WINDOW_MGR_RAISE_LOWER);
uifw_trace("ico_uxf_window_lower: Leave(EOK)");
proc = proc->nextidhash;
}
}
- aproc->attr.active = target;
-
+ if (aproc) {
+ aproc->attr.active = target;
+ }
uifw_trace("ico_uxf_window_active: Leave(EOK)");
return ICO_UXF_EOK;
}
}
}
ico_uxf_window_visible_control(winmng, i | 0x00010000,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ICO_WINDOW_MGR_V_NOCHANGE);
}
winmng = winmng->nextidhash;
}
}
/* request to Weston(Multi Window Manager) */
if (newcontrol == 0) {
+ i = ICO_WINDOW_MGR_VISIBLE_SHOW;
if (gIco_Uxf_Api_Mng.Win_Show_Anima)
- i = ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION;
- else
- i = ICO_WINDOW_MGR_VISIBLE_SHOW;
+ i |= ICO_UXF_WITHANIMA;
}
else {
+ i = ICO_WINDOW_MGR_VISIBLE_HIDE;
if (gIco_Uxf_Api_Mng.Win_Hide_Anima)
- i = ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION;
- else
- i = ICO_WINDOW_MGR_VISIBLE_HIDE;
+ i |= ICO_UXF_WITHANIMA;
}
ico_uxf_window_visible_control(winmng, i,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ICO_WINDOW_MGR_V_NOCHANGE);
}
}
uifw_trace("ico_uxf_window_control: Leave(EOK) control=%x(%d) visible=%d",
if (winmng->attr.control == 0) {
/* request to display to Weston(Multi Window Manager) */
ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_SHOW,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ICO_WINDOW_MGR_V_NOCHANGE);
}
uifw_trace("ico_uxf_window_show: Leave(EOK) control=%x", winmng->attr.control);
return ICO_UXF_EOK;
/* request to hide to Weston(Multi Window Manager) */
ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_HIDE,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ICO_WINDOW_MGR_V_NOCHANGE);
uifw_trace("ico_uxf_window_hide: Leave(EOK)");
return ICO_UXF_EOK;
* and order(raise/lower)
*
* @param[in] window target window identity
- * @param[in] visible visible(1)/unvisible(0)/nochange(9)
- * @param[in] raise forefront(1)/maximum back(0)/nochange(9)
+ * @param[in] visible visible(1)/unvisible(0)/nochange(other)
+ * @param[in] raise forefront(1)/maximum back(0)/nochange(other)
* @return result
* @retval ICO_UXF_EOK success
* @retval ICO_UXF_ESRCH error(not initialized)
}
}
else {
- vis = ICO_WINDOW_MGR_VISIBLE_NOCHANGE;
+ vis = ICO_WINDOW_MGR_V_NOCHANGE;
}
if (raise == 0) {
rai = ICO_WINDOW_MGR_RAISE_LOWER;
rai = ICO_WINDOW_MGR_RAISE_RAISE;
}
else {
- rai = ICO_WINDOW_MGR_RAISE_NOCHANGE;
+ rai = ICO_WINDOW_MGR_V_NOCHANGE;
}
- if ((vis != ICO_WINDOW_MGR_VISIBLE_NOCHANGE) ||
- (rai != ICO_WINDOW_MGR_RAISE_NOCHANGE)) {
+ if ((vis != ICO_WINDOW_MGR_V_NOCHANGE) ||
+ (rai != ICO_WINDOW_MGR_V_NOCHANGE)) {
/* request to visible status and order status to Weston(Multi Window Manager) */
ico_uxf_window_visible_control(winmng, vis, rai);
}
if (show) {
if (winmng->attr.control == 0) {
/* request to display to Weston(Multi Window Manager) */
- ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ico_uxf_window_visible_control(winmng,
+ ICO_WINDOW_MGR_VISIBLE_SHOW|ICO_UXF_WITHANIMA,
+ ICO_WINDOW_MGR_V_NOCHANGE);
}
}
else {
- ico_uxf_window_visible_control(winmng, ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION,
- ICO_WINDOW_MGR_RAISE_NOCHANGE);
+ ico_uxf_window_visible_control(winmng,
+ ICO_WINDOW_MGR_VISIBLE_HIDE|ICO_UXF_WITHANIMA,
+ ICO_WINDOW_MGR_V_NOCHANGE);
}
uifw_trace("ico_uxf_window_visible_animation: Leave(EOK) control=%x",
winmng->attr.control);
* @brief ico_uxf_window_animation: set window animation
*
* @param[in] window Window identity
+ * @param[in] type Target animation type,
* @param[in] animation Animation name, if NULL, no change
* @param[in] time Animation time(ms), if 0, default time
* @return result
*/
/*--------------------------------------------------------------------------*/
ICO_APF_API int
-ico_uxf_window_animation(const int window, const char *animation, const int time)
+ico_uxf_window_animation(const int window, const int type,
+ const char *animation, const int time)
{
Ico_Uxf_Mng_Window *winmng; /* window management table */
- uifw_trace("ico_uxf_window_animation: Enter(%08x,%s,%d)",
- window, animation ? animation : "NULL", time);
+ uifw_trace("ico_uxf_window_animation: Enter(%08x,%x,%s,%d)",
+ window, type, animation ? animation : "NULL", time);
if (gIco_Uxf_Api_Mng.Initialized <= 0) {
uifw_warn("ico_uxf_window_animation: Leave(ESRCH)");
if (animation) {
ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
- winmng->attr.window, animation, time);
+ winmng->attr.window, type, animation, time);
}
else {
ico_window_mgr_set_animation(gIco_Uxf_Api_Mng.Wayland_WindowMgr,
- winmng->attr.window, " ", time);
+ winmng->attr.window, type, " ", time);
}
uifw_trace("ico_uxf_window_animation: Leave(EOK)");
return ICO_UXF_EOK;
#define ICO_HS_ONS_PART_CANCEL_NAME "cancel_bt"
#define ICO_HS_WS_PORT (10001)
+#define ICO_HS_WS_HOST ("127.0.0.1")
#define ICO_HS_APP_NUM_MAX (128)
#define ICO_HS_WINDOW_NUM_MAX (10)
#define ICO_HS_TEMP_BUF_SIZE (256)
#define ICO_HS_NOTILE_APP_MAX (20)
+#define ICO_HS_PROTOCOL "hs-protocol"
+
#define ICO_HS_PROTOCOL_CM "gui-protocol"
/* protocol to communicate external tools */
#define ICO_HS_PROTOCOL_SB "statusbar-protocol"
#define ICO_HS_PROTOCOL_TYPE_SB (2)
#define ICO_HS_PROTOCOL_TYPE_OS (3)
#define ICO_HS_PROTOCOL_TYPE_APP (4)
+#define ICO_HS_MSG_HEAD_CM "GUI"
+#define ICO_HS_MSG_HEAD_SB "STB"
+#define ICO_HS_MSG_HEAD_OS "ONS"
+#define ICO_HS_MSG_HEAD_APP "APP"
+#define HS_REQ_ANS_HELLO "REQ_ANS_HELLO"
#define ICO_HS_SIZE_SB_HEIGHT (64)
#define ICO_HS_SIZE_LAYOUT_WIDTH (768)
/* file_path */
#define default_path "./"
-#define edj_path "/opt/apps/%s/res/edj/"
-#define image_path "/opt/apps/%s/res/images/"
-#define sound_path "/opt/apps/%s/res/sounds/"
-#define manifest_path "/opt/apps/%s/res/config/"
+#define edj_path "/usr/apps/%s/res/edj/"
+#define image_path "/usr/apps/%s/res/images/"
+#define sound_path "/usr/apps/%s/res/sounds/"
+#define manifest_path "/usr/apps/%s/res/config/"
#define local_top_path "/home/tizen/HomeScreen"
#define local_edj_path "%s/src/"
#define local_image_path "%s/res/images/"
typedef struct _ico_uxf_conf_display_zone {
int id;
char *name;
+ short node;
short x;
short y;
short width;
short height;
short zoneidx;
- char res[2]; /* (unused) */
struct _ico_uxf_conf_display *display;
unsigned char overlapNum;
unsigned char overlap[ZONE_MAX_OVERLAP];
struct _ico_uxf_conf_inputdev *inputdev;
char *name;
char *appid;
+ int keycode;
} Ico_Uxf_conf_inputsw;
typedef struct _ico_uxf_conf_inputdev {
#define ICO_UXF_TOP_ENV "UIFW_TOPDIR"
/* Default top directory of UI-FW */
-#define ICO_UXF_TOP_TOPDIR "/opt/apps/org.tizen.ico.homescreen"
+#define ICO_UXF_TOP_TOPDIR "/usr/apps/org.tizen.ico.homescreen"
/* Environment variable for top directory of cconfiguration files */
#define ICO_UXF_CONFIG_ENV "UIFW_CONFDIR"
#define ICO_UXF_LOGLEVEL_INFO 64 /* Information */
#define ICO_UXF_LOGLEVEL_DEBUG 128 /* Debug write */
-/* Macros for generate hash value */
+/* Macros for node Id */
+#define ICO_UXF_NODEID_2_HOSTID(nodeid) (((unsigned int)nodeid) >> 8)
+#define ICO_UXF_NODEID_2_DISPLAYNO(nodeid) (((unsigned int)nodeid) & 0x0ff)
+#define ICO_UXF_NODEDISP_2_NODEID(nodeid, displayno) \
+ ((nodeid << 8) | displayno)
+#define ICO_UXF_SURFACEID_2_HOSTID(surfid) (((unsigned int)surfid) >> 24)
+#define ICO_UXF_SURFACEID_2_DISPLAYNO(surfid) ((((unsigned int)surfid) >> 16) & 0x0ff)
+#define ICO_UXF_SURFACEID_2_NODEID(surfid) (((unsigned int)surfid) >> 16)
+#define ICO_UXF_SURFACEID_BASE(nodeid) (((unsigned int)nodeid) << 16)
+
+/* Macros for generate hash value */
extern int ico_uxf_misc_hashByName(const char *name);
#define ICO_UXF_MISC_HASHSIZE 64 /* Hash table size(must be 2's factorial*/
#define ICO_UXF_MISC_HASHBYID(v) (v & (ICO_UXF_MISC_HASHSIZE-1))
/* Set window show/hide and raise/lower */
int ico_uxf_window_resize(const int window, const int w, const int h);
/* Resize window size */
-int ico_uxf_window_move(const int window, const int x, const int y);
+int ico_uxf_window_move(const int window, const int x, const int y, const int anima);
/* Move window */
int ico_uxf_window_raise(const int window);
/* Raise window */
/* Lower window */
int ico_uxf_window_active(const int window, const int target);
/* Activate window */
-int ico_uxf_window_animation(const int window, const char *animation, const int time);
+int ico_uxf_window_animation(const int window, const int type,
+ const char *animation, const int time);
/* Set window animation */
void ico_uxf_window_animation_control(const int control, const int animation);
/* Set animation control */
Ico_Uxf_InputSw *ico_uxf_inputsw_attribute_get(Ico_Uxf_InputDev *inputdev, const int swidx);
/* get input switch attribute */
int ico_uxf_input_control(const int add, const char *appid,
- const char *device, const int input);
+ const char *device, const int input, const int keycode);
/* control input switch */
/* Launcher API */
int ico_uxf_process_execute(const char *name);
char res[3]; /* (unused) */
} Ico_Uxf_LayerAttr;
-/* Structure of display zone attribute */
-typedef struct _Ico_Uxf_DispZoneAttr {
- int zone; /* Zone ID */
- int display; /* Display ID */
- short x; /* Left upper X coordinate of the screen*/
- short y; /* Left upper Y coordinate of the screen*/
- short w; /* The number of the lateral pixels */
- short h; /* The number of vertical pixels */
-} Ico_Uxf_DispZoneAttr;
-
/* Structure of window attribute */
typedef struct _Ico_Uxf_WindowAttr {
int window; /* Window ID */
int zone; /* Display Zone ID */
char process[ICO_UXF_MAX_PROCESS_NAME+1];
/* Application ID */
- int subwindow; /* Main window(=0) or Sub window(>0) */
unsigned int eventmask; /* Event to receive through this window */
+ short subwindow; /* Main window(=0) or Sub window(>0) */
+ short node; /* Node Id */
short x; /* Upper left X coordinate of the window*/
short y; /* Upper left Y coordinate of the window*/
short w; /* Width of window */
int windowtype; /* Type */
int display; /* Display ID */
int layer; /* Layer ID */
- int zone; /* Zone ID */
+ short zone; /* Zone ID */
+ short node; /* Default node Id */
short x; /* Default X coordinate of the window */
short y; /* Default Y coordinate of the window */
short w; /* Default width of window */
#!/bin/sh
-rm -rf /opt/apps/org.tizen.ico.dummy*
-rm -rf /opt/share/applications/org.tizen.ico.dummy*
-
#library(libico-app-fw)
rm -fr /usr/lib/libico-app-fw-efl.*
-cp ico-app-framework/.libs/libico-app-fw-efl.so.0.0.5 /usr/lib
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so.0
-ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so
-chmod 0755 /usr/lib/libico-app-fw-efl.so.0.0.5
+cp ico-app-framework/.libs/libico-app-fw-efl.so.0.0.7 /usr/lib
+ln -s /usr/lib/libico-app-fw-efl.so.0.0.7 /usr/lib/libico-app-fw-efl.so.0
+ln -s /usr/lib/libico-app-fw-efl.so.0.0.7 /usr/lib/libico-app-fw-efl.so
+chmod 0755 /usr/lib/libico-app-fw-efl.so.0.0.7
rm -fr /usr/lib/libico-app-fw.*
-cp ico-app-framework/.libs/libico-app-fw.so.0.0.5 /usr/lib
-ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so.0
-ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so
-chmod 0755 /usr/lib/libico-app-fw.so.0.0.5
+cp ico-app-framework/.libs/libico-app-fw.so.0.0.7 /usr/lib
+ln -s /usr/lib/libico-app-fw.so.0.0.7 /usr/lib/libico-app-fw.so.0
+ln -s /usr/lib/libico-app-fw.so.0.0.7 /usr/lib/libico-app-fw.so
+chmod 0755 /usr/lib/libico-app-fw.so.0.0.7
#test tools
rm -fr /usr/bin/ico_send_hscommand
#HomeScreen
HOMESCREEN=org.tizen.ico.homescreen
-rm -rf /opt/apps/$HOMESCREEN/var
-rm -rf /opt/apps/$HOMESCREEN/res
-mkdir -p /opt/apps/$HOMESCREEN/res/images
-mkdir -p /opt/apps/$HOMESCREEN/res/edj
-mkdir -p /opt/apps/$HOMESCREEN/res/config
-cp -rf res/config /opt/apps/$HOMESCREEN/res
-cp -rf data/apps/$HOMESCREEN /opt/apps/
-mkdir -p /opt/apps/$HOMESCREEN/bin/
-cp src/HomeScreen /opt/apps/$HOMESCREEN/bin/
-cp src/home_screen_bg.edj /opt/apps/$HOMESCREEN/res/edj
-cp src/home_screen_touch.edj /opt/apps/$HOMESCREEN/res/edj
-chmod 666 /opt/apps/$HOMESCREEN/res/edj/home_screen_*
-cp res/images/api_all_off.png /opt/apps/$HOMESCREEN/res/images
-cp res/images/api_all_on.png /opt/apps/$HOMESCREEN/res/images
-chmod 666 /opt/apps/$HOMESCREEN/res/images/api_all_*
-cp data/share/applications/$HOMESCREEN.desktop /opt/share/applications/
-cp res/apps/$HOMESCREEN/* /opt/apps/$HOMESCREEN/res/config
+rm -rf /usr/apps/$HOMESCREEN/var
+rm -rf /usr/apps/$HOMESCREEN/res
+mkdir -p /usr/apps/$HOMESCREEN/res/images
+mkdir -p /usr/apps/$HOMESCREEN/res/edj
+mkdir -p /usr/apps/$HOMESCREEN/res/config
+cp -rf res/config /usr/apps/$HOMESCREEN/res
+cp -rf data/apps/$HOMESCREEN /usr/apps/
+mkdir -p /usr/apps/$HOMESCREEN/bin/
+cp src/HomeScreen /usr/apps/$HOMESCREEN/bin/
+cp src/home_screen_bg.edj /usr/apps/$HOMESCREEN/res/edj
+cp src/home_screen_touch.edj /usr/apps/$HOMESCREEN/res/edj
+chmod 666 /usr/apps/$HOMESCREEN/res/edj/home_screen_*
+cp res/images/api_all_off.png /usr/apps/$HOMESCREEN/res/images
+cp res/images/api_all_on.png /usr/apps/$HOMESCREEN/res/images
+chmod 666 /usr/apps/$HOMESCREEN/res/images/api_all_*
+cp data/share/applications/$HOMESCREEN.desktop /usr/share/applications/
+cp data/share/packages/$HOMESCREEN.xml /usr/share/packages/
+cp res/apps/$HOMESCREEN/* /usr/apps/$HOMESCREEN/res/config
#StatusBar
PKGNAME=org.tizen.ico.statusbar
-rm -rf /opt/apps/$PKGNAME/res
-mkdir -p /opt/apps/$PKGNAME/res/images
-mkdir -p /opt/apps/$PKGNAME/res/edj
-mkdir -p /opt/apps/$PKGNAME/res/config
-cp -rf data/apps/$PKGNAME /opt/apps/
-mkdir -p /opt/apps/$PKGNAME/bin/
-cp src/StatusBar /opt/apps/$PKGNAME/bin/
-cp res/images/time*.png /opt/apps/$PKGNAME/res/images
-cp res/images/applist_*.png /opt/apps/$PKGNAME/res/images
-cp res/images/home*.png /opt/apps/$PKGNAME/res/images
-chmod 666 /opt/apps/$PKGNAME/res/images/time*.png
-cp data/share/applications/$PKGNAME.desktop /opt/share/applications/
-cp res/apps/$PKGNAME/* /opt/apps/$PKGNAME/res/config
+rm -rf /usr/apps/$PKGNAME/res
+mkdir -p /usr/apps/$PKGNAME/res/images
+mkdir -p /usr/apps/$PKGNAME/res/edj
+mkdir -p /usr/apps/$PKGNAME/res/config
+cp -rf data/apps/$PKGNAME /usr/apps/
+mkdir -p /usr/apps/$PKGNAME/bin/
+cp src/StatusBar /usr/apps/$PKGNAME/bin/
+cp res/images/time*.png /usr/apps/$PKGNAME/res/images
+cp res/images/applist_*.png /usr/apps/$PKGNAME/res/images
+cp res/images/home*.png /usr/apps/$PKGNAME/res/images
+chmod 666 /usr/apps/$PKGNAME/res/images/time*.png
+cp data/share/applications/$PKGNAME.desktop /usr/share/applications/
+cp data/share/packages/$PKGNAME.xml /usr/share/packages/
+cp res/apps/$PKGNAME/* /usr/apps/$PKGNAME/res/config
#OnScreen
PKGNAME=org.tizen.ico.onscreen
-rm -rf /opt/apps/$PKGNAME/res
-mkdir -p /opt/apps/$PKGNAME/res/images
-mkdir -p /opt/apps/$PKGNAME/res/edj
-mkdir -p /opt/apps/$PKGNAME/res/config
-cp -rf data/apps/$PKGNAME /opt/apps/
-mkdir -p /opt/apps/$PKGNAME/bin/
-cp src/OnScreen /opt/apps/$PKGNAME/bin/
-cp src/appli_list.edj /opt/apps/$PKGNAME/res/edj
-cp src/appli_kill.edj /opt/apps/$PKGNAME/res/edj
-chmod 666 /opt/apps/$PKGNAME/res/edj/*.edj
-chmod 666 /opt/apps/$PKGNAME/res/images/*.png > /dev/null 2>&1
-cp data/share/applications/$PKGNAME.desktop /opt/share/applications/
-cp res/apps/$PKGNAME/* /opt/apps/$PKGNAME/res/config
-
-#delete dummy apps
-rm -rf /opt/apps/org.tizen.ico.sample.*
-rm -f /opt/share/applications/org.tizen.ico.sample.*
+rm -rf /usr/apps/$PKGNAME/res
+mkdir -p /usr/apps/$PKGNAME/res/images
+mkdir -p /usr/apps/$PKGNAME/res/edj
+mkdir -p /usr/apps/$PKGNAME/res/config
+cp -rf data/apps/$PKGNAME /usr/apps/
+mkdir -p /usr/apps/$PKGNAME/bin/
+cp src/OnScreen /usr/apps/$PKGNAME/bin/
+cp src/appli_list.edj /usr/apps/$PKGNAME/res/edj
+cp src/appli_kill.edj /usr/apps/$PKGNAME/res/edj
+chmod 666 /usr/apps/$PKGNAME/res/edj/*.edj
+chmod 666 /usr/apps/$PKGNAME/res/images/*.png > /dev/null 2>&1
+cp data/share/applications/$PKGNAME.desktop /usr/share/applications/
+cp data/share/packages/$PKGNAME.xml /usr/share/packages/
+cp res/apps/$PKGNAME/* /usr/apps/$PKGNAME/res/config
#reload AppCore database
-cd /opt/dbspace
-rm -rf .app_info*
+/usr/bin/pkg_initdb
/usr/bin/ail_initdb
+* Mon Jul 29 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/2.0alpha-wayland/20130612.174826@c0f6e8c
+- 0.7.01 release
+- Following corrections for TizenIVI 3.0M1.
+-- Correspondence to version up of Wayland/Weston(1.1.x => 1.2.0).
+-- Correspondence to version up of ico-uxf-weston-plugin(0.5.x => 0.7.01).
+-- Correspondence to start method of TizenIVI 3.0(system V => systemd).
+- Changes of the package name from 'ico-uxf-HomeScreen' to 'ico-uxf-homescreen'.
+
+- 0.3.08 release
+- fix for - SystemController may give the screen right for the application that is not active.
+- fix for - SystemController gives the screen right for two application when 3 or more apprications require the acquisition of the screen right of the screen zone.
+- Abstraction of communication library.
+ Change to libico-util-com.so(ico-uxf-utilities.rpm) from libwebsockets.so.
+
* Wed Jun 12 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/2.0alpha-wayland/20130612.051552@7006a0f
- 0.3.07 release
- Fix for TIVI-1002 - [WLD] Entertainment.Visual APP doesn't stop the audio play and show the window while vehicle speed>=4
-Name: ico-uxf-HomeScreen
+Name: ico-uxf-homescreen
Summary: sample homescreen
-Version: 0.3.07
+Version: 0.7.01
Release: 1.1
Group: TO_BE/FILLED_IN
License: Apache License, Version 2.0
URL: ""
Source0: %{name}-%{version}.tar.bz2
-BuildRequires: pkgconfig(wayland-client) >= 1.0
+BuildRequires: pkgconfig(wayland-client) >= 1.2
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: ico-uxf-weston-plugin-devel >= 0.5.05
+BuildRequires: ico-uxf-weston-plugin-devel >= 0.7
BuildRequires: pkgconfig(eina)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(eina)
BuildRequires: libwebsockets-devel
BuildRequires: capi-base-common-devel
BuildRequires: edje-tools
-Requires: weston >= 1.0
-Requires: ico-uxf-weston-plugin >= 0.5.05
+BuildRequires: ico-uxf-utilities-devel
+Requires: weston >= 1.2
+Requires: ico-uxf-weston-plugin >= 0.7
+Requires: ico-uxf-utilities
%description
Sample homescreen application.
Requires: pkgconfig(elementary)
Requires: pkgconfig(ecore-wayland)
Requires: pkgconfig(ecore-x)
+Requires: ico-uxf-utilities
%description devel
Development files for application that communicate homescreen.
%prep
%setup -q -n %{name}-%{version}
-%define PREFIX /opt/apps/
+%define PREFIX /usr/apps/
%build
autoreconf --install
%configure
make %{?_smp_mflags}
-%global ico_sysvlinkdir %{_sysconfdir}/rc.d/rc3.d
+%define ico_unitdir_system /usr/lib/systemd/system
%install
rm -rf %{buildroot}
%make_install
-%define ictl_conf /opt/etc/ico-uxf-device-input-controller
-mkdir -p %{buildroot}/opt/share/applications/
+mkdir -p %{buildroot}/usr/share/applications/
+mkdir -p %{buildroot}/usr/share/packages/
# include
mkdir -p %{buildroot}/%{_includedir}/ico-appfw/
install -m 0644 src/home_screen_touch.edj %{buildroot}%{APPSDIR}/res/edj
install -m 0644 res/images/api_all_off.png %{buildroot}%{APPSDIR}/res/images
install -m 0644 res/images/api_all_on.png %{buildroot}%{APPSDIR}/res/images
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/opt/share/applications/
+install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/usr/share/applications/
+install -m 0644 data/share/packages/%{APP}.xml %{buildroot}/usr/share/packages/
#statusbar
%define APP org.tizen.ico.statusbar
install -m 0644 res/images/time*.png %{buildroot}%{APPSDIR}/res/images/
install -m 0644 res/images/applist_*.png %{buildroot}%{APPSDIR}/res/images/
install -m 0644 res/images/home*.png %{buildroot}%{APPSDIR}/res/images/
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/opt/share/applications/
+install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/usr/share/applications/
+install -m 0644 data/share/packages/%{APP}.xml %{buildroot}/usr/share/packages/
#onscreen
%define APP org.tizen.ico.onscreen
install -m 0755 src/OnScreen %{buildroot}%{APPSDIR}/bin/
install -m 0644 src/appli_list.edj %{buildroot}%{APPSDIR}/res/edj/
install -m 0644 src/appli_kill.edj %{buildroot}%{APPSDIR}/res/edj/
-install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/opt/share/applications/
+install -m 0644 data/share/applications/%{APP}.desktop %{buildroot}/usr/share/applications/
+install -m 0644 data/share/packages/%{APP}.xml %{buildroot}/usr/share/packages/
#settings
-mkdir -p %{buildroot}/opt/etc/ico
+mkdir -p %{buildroot}/opt/etc/ico/
install -m 0644 settings/mediation_table.txt %{buildroot}/opt/etc/ico/
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
-mkdir -p %{buildroot}%{ico_sysvlinkdir}
-install -m 0755 settings/ico_weston %{buildroot}%{_sysconfdir}/rc.d/init.d/
-ln -sf %{_sysconfdir}/rc.d/init.d/ico_weston %{buildroot}%{ico_sysvlinkdir}/S91ico_weston
+mkdir -p %{buildroot}/etc/systemd/system/graphical.target.wants
+mkdir -p %{buildroot}%{ico_unitdir_system}/
+install -m 0644 settings/ico_homescreen.service %{buildroot}%{ico_unitdir_system}/
+ln -sf ../../../../usr/lib/systemd/system/ico_homescreen.service %{buildroot}/etc/systemd/system/graphical.target.wants/
-%global ico_packagestatedir %{_localstatedir}/lib/rpm-state/%{name}
+# Update the package database (post only).
%post
-# The homescreen boot script will start Weston in a specific order.
-# Disable stand-alone boot of Weston by removing the link to its boot
-# script in /etc/rc.d/rc3.d. Store it for later restoration after
-# uninstallation of this package.
-mkdir -p %{ico_packagestatedir} > /dev/null 2>&1
-mv -f %{ico_sysvlinkdir}/S??weston %{ico_packagestatedir} > /dev/null 2>&1
-set $?=0
-
-# Update the app database.
-rm -f /opt/dbspace/.app_info.db*
-ail_initdb
-
-%postun
-# Restore the link to the Weston boot script.
-mv %{ico_packagestatedir}/S??weston %{ico_sysvlinkdir} > /dev/nukk 2>&1
-rm -fr %{ico_packagestatedir}
-set $?=0
-
-# Update the app database.
-rm -f /opt/dbspace/.app_info.db*
-ail_initdb
+mkdir -p /var/log/ico/
+chmod 0777 /var/log/ico/
+/usr/bin/pkg_initdb
+/usr/bin/ail_initdb
%files
%defattr(-,root,root,-)
%{PREFIX}/org.tizen.ico.homescreen
%{PREFIX}/org.tizen.ico.statusbar
%{PREFIX}/org.tizen.ico.onscreen
-/opt/share/applications/*.desktop
+/usr/share/applications/*.desktop
+/usr/share/packages/*.xml
+/opt/etc/ico/mediation_table.txt
+%{ico_unitdir_system}/ico_homescreen.service
+/etc/systemd/system/graphical.target.wants/ico_homescreen.service
%{_libdir}/*.so.*
%{_bindir}/ico_*
-/opt/etc/ico/mediation_table.txt
-%{_sysconfdir}/rc.d/init.d/ico_weston
-%{ico_sysvlinkdir}/S91ico_weston
-
%files devel
%defattr(-,root,root,-)
%{_includedir}/ico-appfw/ico_apf.h
--- /dev/null
+#!/bin/sh
+
+#reload AppCore database
+/usr/bin/pkg_initdb
+/usr/bin/ail_initdb
+
statusbar=org.tizen.ico.statusbar
onscreen=org.tizen.ico.onscreen
-bgimage=/opt/share/settings/Wallpapers/Home_default.jpg
+bgimage=/opt/usr/media/Images/image1.jpg
[sound]
#configuration for sounds
--- /dev/null
+[homescreen]
+#tileinfo_rowcnt=3
+#tileinfo_colcnt=5
+#tileinfo_valid=1;0;1;1;0;0;0;1;1;1;1;1;0;1;0
+#tileinfo_type=22;0;11;12;0;0;0;21;11;11;11;11;0;12;0
+#tileinfo_app0=org.tizen.browser
+#tileinfo_app3=org.tizen.music-player
+#tileinfo_app2=org.tizen.gallery
+#tileinfo_app7=org.tizen.setting
+#tileinfo_app8=org.tizen.calendar
+#tileinfo_app9=org.tizen.dialer
+#tileinfo_app10=org.tizen.calculator
+#tileinfo_app11=org.tizen.memo
+#tileinfo_app13=org.tizen.smartsearch
+#tileinfo_app14=none
+tileinfo_rowcnt=5
+tileinfo_colcnt=3
+tileinfo_valid=1;0;1;0;0;1;1;1;0;1;0;1;1;1;0
+tileinfo_type=22;0;11;0;0;21;11;11;0;12;0;11;11;12;0
+tileinfo_app0=org.tizen.browser
+tileinfo_app2=org.tizen.music-player
+tileinfo_app5=org.tizen.gallery
+tileinfo_app6=org.tizen.setting
+tileinfo_app7=org.tizen.calendar
+#tileinfo_app9=org.tizen.dialer
+tileinfo_app9=AKsMREAjt9
+tileinfo_app11=org.tizen.calculator
+tileinfo_app12=org.tizen.memo
+tileinfo_app13=org.tizen.smartsearch
+tileinfo_app14=none
+
+statusbar=org.tizen.ico.statusbar
+onscreen=org.tizen.ico.onscreen
+
+bgimage=/opt/usr/media/Images/Home_default.jpg
+
+[sound]
+#configuration for sounds
+sound_default=/usr/share/sounds/mm-camcorder/af_succeed.wav
+
## onscreen private configration
[onscreen]
wsport=10001
-#orientaion(1:VERTICAL, 2:HORIZONTAL)
-#orientaion=2
-
+#orientation(1:VERTICAL, 2:HORIZONTAL)
+#orientation=1
[sound]
#configuration for sounds
## statusbar private configration
[statusbar]
wsport=10001
-##orientaion(1:VERTICAL, 2:HORIZONTAL)
-#orientaion=2
+#orientation(1:VERTICAL, 2:HORIZONTAL)
+#orientation=1
shortcut_app0=org.tizen.ico.app-samplenavi
shortcut_app1=org.tizen.music-player
+shortcut_app2=AKsMREAjt9
[sound]
#configuration for sounds
## OpenPF System Configurations
-## /opt/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
-## May-15-2013
+## /usr/apps/org.tizen.ico.homescreen/res/config/app_attr.conf
+## Jul-26-2013
#
+## default icon
+[app-icon]
+default-icon=/opt/usr/apps/t8j6HTRpuz/res/wgt/images/tizen_32.png
+
## default attributes for each application
[app-attributes]
+# attributes of HomeScreen
+org.tizen.ico.homescreen=Menu;HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.onscreen=Menu;HomeScreen;run=Center;noauto;type=menu
+org.tizen.ico.statusbar=Menu;HomeScreen;run=Center;noauto;type=menu
+
# attrinutes of native applictions
org.tizen.soft-keyboard=Menu;SysApp;dispzone=SysApp;layer=SoftKeyboard
org.tizen.setting=CarSetting;kind=SysApp.audio
org.tizen.music-player=Map
+
# attributes of web applications
DemoMeterApp=Map
GhostCluster=Map
## OpenPF System Configurations
-## /opt/apps/org.tizen.ico.homescreen/res/config/system.conf
+## /usr/apps/org.tizen.ico.homescreen/res/config/system.conf
## May-15-2013
## System ECUs
7.privilege=none
7.priority=0
#
-## Input Sw
+## Fixed Input Sw
[input]
+#-.sw.-=switch-name:appid[;keycode]
0=DrivingForceGT
0.sw.0=JS_UpDown
0.sw.1=JS_LR
0.sw.2=JS_Cross;org.tizen.ico.app-soundsample
-0.sw.3=JS_Square;org.tizen.ico.homescreen
+0.sw.3=JS_Square;org.tizen.ico.homescreen;0x0a
0.sw.4=JS_Circle;org.tizen.ico.app-soundsample
0.sw.5=JS_Triangle;org.tizen.ico.homescreen
#
--- /dev/null
+[Unit]
+Description=Ico HomeScreen
+Requires=graphical.target
+After=graphical.target
+
+[Service]
+ExecStart=/usr/bin/launch_app org.tizen.ico.homescreen &
+
+[Install]
+WantedBy=graphical.target
--- /dev/null
+#!/bin/sh
+/usr/bin/echo "launch kick HomeScreen sleeping"
+sleep 20
+/usr/bin/echo "launch kick HomeScreen org.tizen.ico.homescreen"
+/usr/bin/launch_app org.tizen.ico.homescreen &
+/usr/bin/echo "launch end HomeScreen org.tizen.ico.homescreen"
+
+++ /dev/null
-#! /bin/sh
-# Provides: ico_uxf_HomeScreen
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Homescreen boot script for ico-ivi
-# Description: This script starts the Weston compositor and ico-uxf-HomeScreen at boot.
-
-# Do NOT "set -e"
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="ICO UXF Home Screen"
-NAME=ico_uxf_HomeScreen
-DAEMON=/usr/bin/launch_app
-DAEMON_ARGS="org.tizen.ico.homescreen"
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-
-ICO_LOG_DIR=/var/log/ico
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-# and status_of_proc is working.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
- # Return
- # 0 if daemon has been started
- # 1 if daemon was already running
- # 2 if daemon could not be started
- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
- || return 1
-
- # make and clean log directory
- if [ ! -d "${ICO_LOG_DIR}" ]; then
- mkdir -p $ICO_LOG_DIR
- fi
-
- /bin/chmod -R 0777 /var/log/ico
- /bin/rm -f /var/log/ico/*
-
- # kill pulseaudio and weston, and start pulseaudio
- /usr/bin/killall pulseaudio > /dev/null 2>&1
- /etc/init.d/weston stop > /dev/null 2>&1
- /bin/sleep 0.2
- /usr/bin/killall -9 pulseaudio > /dev/null 2>&1
- /usr/bin/killall -9 weston > /dev/null 2>&1
-
- # Start Device Input Controller for eGalax TouchPanel
- #/usr/bin/ico_ictl-touch_egalax -t
- /usr/bin/ico_ictl-touch_egalax
-
- # re-load launchpad
- /bin/ps ax | /bin/grep launchpad_preloading | /bin/grep -v grep > /dev/null
- if [ "$?" = "0" ] ; then
- /usr/bin/killall launchpad_preloading_preinitializing_daemon
- /bin/sleep 0.3
- fi
- /usr/bin/launchpad_preloading_preinitializing_daemon &
-
- # Start weston
- /etc/init.d/weston start
-
- # Start wayland-client for display mouse cursor
- #/usr/bin/nice -19 /usr/bin/wayland-smoke &
-
- ## if pulseaudio does not start ... kick pulseaudio
- /bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
- if [ "$?" = "1" ] ; then
- /usr/bin/pulseaudio --log-level=3 --log-target=file:/var/log/ico/pulse.log --system -D
- /bin/sleep 0.2
- fi
-
- # Start HomeScreen
- /bin/sleep 0.5
- /usr/bin/killall menu-screen
- /usr/bin/killall menu-daemon
- /usr/bin/pmctrl stop
-
- # start-stop-daemon --start --background --quiet --pidfile $PIDFILE --exec $DAEMON -- \
- # $DAEMON_ARGS \
- # || return 2
- $DAEMON $DAEMON_ARGS &
- /bin/sleep 0.2
- homescreen_pid=`pidof HomeScreen`
-
- if [ $homescreen_pid = 0 ]; then
- return 2
- else
- echo $homescreen_pid > $PIDFILE
- fi
-
- # Add code here, if necessary, that waits for the process to be ready
- # to handle requests from services started subsequently which depend
- # on this one. As a last resort, sleep for some time.
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
- # Return
- # 0 if daemon has been stopped
- # 1 if daemon was already stopped
- # 2 if daemon could not be stopped
- # other if a failure occurred
- #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Wait for children to finish too if this is a daemon that forks
- # and if the daemon is only ever run from this initscript.
- # If the above conditions are not satisfied then add some other code
- # that waits for the process to drop all resources that could be
- # needed by services started subsequently. A last resort is to
- # sleep for some time.
- #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
- start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
- [ "$?" = 2 ] && return 2
- # Many daemons don't delete their pidfiles when they exit.
- rm -f $PIDFILE
-
- # Stop Weston.
- /etc/init.d/weston stop
-
- return "$RETVAL"
-}
-
-#
-# Function that sends a SIGHUP to the daemon/service
-#
-do_reload() {
- #
- # If the daemon can reload its configuration without
- # restarting (for example, when it is sent a SIGHUP),
- # then implement that here.
- #
- start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
- return 0
-}
-
-case "$1" in
- start)
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- stop)
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
- esac
- ;;
- status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
- #reload|force-reload)
- #
- # If do_reload() is not implemented then leave this commented out
- # and leave 'force-reload' as an alias for 'restart'.
- #
- #log_daemon_msg "Reloading $DESC" "$NAME"
- #do_reload
- #log_end_msg $?
- #;;
- restart|force-reload)
- #
- # If the "reload" option is implemented then remove the
- # 'force-reload' alias
- #
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
-
-:
home_screen_lib.c \
home_screen_sound.c \
resource_conf.c
-HomeScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS)
-HomeScreen_LDADD = $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so
+HomeScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS)
+HomeScreen_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(DBUS_LIBS) $(UWS_LIBS)
OnScreen_SOURCES = \
on_screen.c \
home_screen_conf.c \
home_screen_sound.c \
resource_conf.c
-OnScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS)
-OnScreen_LDADD = $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so
+OnScreen_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS) -I/usr/include/ico-util
+OnScreen_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS)
StatusBar_SOURCES = \
status_bar.c \
home_screen_conf.c \
home_screen_sound.c \
resource_conf.c
-StatusBar_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS)
-StatusBar_LDADD = $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so
+StatusBar_CFLAGS = -I../include $(EFL_CFLAGS) $(OPT_CFLAGS) $(WL_CFLAGS) $(AUL_CFLAGS) $(UWS_CFLAGS)
+StatusBar_LDADD = ../apps_controller/libico_syc-apc.a ../ico-app-framework/.libs/libico-app-fw-efl.so ../ico-app-framework/.libs/libico-app-fw.so $(EFL_LIBS) $(OPT_LIBS) $(WL_LIBS) $(COMMON_LIBS) $(AUL_LIBS) $(UWS_LIBS)
SUFFIXES = .edc .edj
GKeyFile *homescreen;
GString *filepath;
+ uifw_trace("initHomeScreenConfig: open=%d", hs_is_open_config);
if (hs_is_open_config == TRUE) {
return ICO_HS_ERR;
}
hs_get_conf_path(path, sizeof(path));
g_string_printf(filepath, "%s/%s", path, conf);
if (!g_file_test(filepath->str, G_FILE_TEST_IS_REGULAR)) {
+ uifw_warn("%s: config file dose not exist", filepath->str);
return ICO_HS_ERR;
}
uifw_warn("%s: %s", filepath->str, error->message);
g_error_free(error);
}
+ uifw_trace("config file(%s)", filepath->str);
g_string_free(filepath, TRUE);
if (error != NULL) {
/*--------------------------------------------------------------------------*/
/**
* @brief hs_conf_get_integer
- * Return integer value in homescreen configuration file.
+ * Return integer value in homescreen configuration file.
* If not exist,return defaultvlaue in params.
*
* @param[in] group_name configuration group name
int value = g_key_file_get_integer(hs_config_key, group_name, key, &error);
if (error != NULL) {
- uifw_warn("%s", error->message);
+ uifw_warn("%s:%s %s", group_name, key, error->message);
g_error_free(error);
return default_value;
}
/*--------------------------------------------------------------------------*/
/**
* @brief hs_conf_get_string
- * Return string value in homescreen configuration file.
+ * Return string value in homescreen configuration file.
* If not exist,return defaultvlaue in params.
*
* @param[in] group_name configuration group name
const char *value = g_key_file_get_string(hs_config_key, group_name, key,
&error);
if (error != NULL) {
- uifw_warn("%s", error->message);
+ uifw_warn("%s:%s %s", group_name, key, error->message);
g_error_free(error);
return default_value;
}
#include <sys/epoll.h>
#include <getopt.h>
-#include <libwebsockets.h>
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
+#include <ico_uws.h>
+
#include "ico_uxf.h"
#include "ico_uxf_conf_common.h"
/* definition */
/*============================================================================*/
#define WEBSOCKET_MAX_BUFFER (4096)
-#define HS_REQ_ANS_HELLO "REQ_ANS_HELLO"
typedef struct _hs_lib_poll hs_lib_poll_t;
typedef struct _hs_lib_handle hs_lib_handle_t;
typedef struct _hs_lib_msg hs_lib_msg_t;
/* management connection */
struct _hs_lib_handle {
hs_lib_handle_t *next; /* next handle */
- int fd; /* Socket file descriptor */
+ int fd; /* Socket file descriptor */
int service_on;
int type;
- struct libwebsocket_context *wsi_context;
+ struct ico_uws_context *uws_context;
/* Context of libwebsockets */
- struct libwebsocket *wsi; /* WSI of libwebsockets */
+ void *id; /* id */
hs_lib_poll_t *poll;
char appid[ICO_UXF_MAX_PROCESS_NAME];
};
/*============================================================================*/
/* variabe */
/*============================================================================*/
-static struct libwebsocket_context *hs_wsicontext = NULL;
+static struct ico_uws_context *hs_wsicontext = NULL;
static hs_lib_msg_t *hs_send_msg = NULL;
static hs_lib_msg_t *hs_recv_msg = NULL;
static hs_lib_msg_t *hs_free_msg = NULL;
/*============================================================================*/
/* Function prototype for static(internal) functions */
/*============================================================================*/
+static hs_lib_handle_t *hs_lib_setup_server(const char *uri,
+ const char *protocol, ico_uws_evt_cb callback);
+static void hs_lib_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data);
static void hs_lib_handle_command(hs_lib_msg_t *msg);
static void hs_lib_handle_application(hs_lib_msg_t *msg);
static void hs_lib_handle_onscreen(hs_lib_msg_t *msg);
static void hs_lib_clear_mode_poll_fd(int fd, int flags);
static char *get_parsed_str(char *in, char *out, int len, int arg_idx);
static char *getFileName(char *filepath, int len);
-static int hs_lib_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
-static int hs_lib_callback_command(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
-static int hs_lib_callback_statusbar(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len);
-static int hs_lib_callback_onscreen(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
-static int hs_lib_callback_app(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
-
-/*============================================================================*/
-/* table */
-/*============================================================================*/
-static struct libwebsocket_protocols protocols[] = {
- {
- "http-only",
- hs_lib_callback_http,
- 0
- },
- { /* HomeScreen - command */
- ICO_HS_PROTOCOL_CM,
- hs_lib_callback_command,
- 0
- },
- { /* HomeScreen - StatusBar */
- ICO_HS_PROTOCOL_SB,
- hs_lib_callback_statusbar,
- 0
- },
- { /* HomeScreen - OnScreen */
- ICO_HS_PROTOCOL_OS,
- hs_lib_callback_onscreen,
- 0
- },
- { /* HomeScreen - OtherNatiiveApps */
- ICO_HS_PROTOCOL_APP,
- hs_lib_callback_app,
- 0
- },
- {
- NULL,
- NULL,
- 0
- }
-};
/*============================================================================*/
/* functions */
/* native apps only */
hs_hide_onscreen();
memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
- /* disconnect app-protocol */
- if ((msg->handle != NULL) && (msg->handle->wsi != NULL)) {
- libwebsocket_close_and_free_session(msg->handle->wsi_context,
- msg->handle->wsi,
- LWS_CLOSE_STATUS_NORMAL);
- }
}
uifw_trace("hs_lib_handle_application: Leave");
}
int ret, idx;
const Ico_Uxf_conf_application *appConf = NULL;
char *data = msg->data;
- hs_lib_handle_t *handle;
hs_lib_msg_t *send;
uifw_trace("hs_lib_handle_onscreen: Enter");
hs_hide_onscreen();
}
memset(hs_active_onscreen, 0, sizeof(hs_active_onscreen));
- /* disconnect app-protocol */
- handle = hs_handles;
- while (handle) {
- if (handle->type == ICO_HS_PROTOCOL_TYPE_APP) {
- libwebsocket_close_and_free_session(handle->wsi_context,
- handle->wsi,
- LWS_CLOSE_STATUS_NORMAL);
-
- }
- handle = handle->next;
- }
}
}
else if (strncmp("TOUCH", data, 5) == 0) {
/* get 3rd phrase */
ptr = get_parsed_str(p_msg_data, tmp_buf, sizeof(tmp_buf), 2);
appConf = ico_uxf_getAppByAppid(ptr);
- uifw_trace(
- "hs_lib_handle_onscreen: hs_tile_get_index_app = %d(%s)",
+ uifw_trace("hs_lib_handle_onscreen: hs_tile_get_index_app = %08x(%s)",
(int)appConf, ptr);
if (appConf != NULL) {
sprintf(msg_buf, "FOCUS %s", ptr);
send = hs_lib_alloc_msg(msg_buf, strlen(msg_buf));
if (!send) {
- uifw_warn(
- "hs_lib_handle_onscreen: ERROR(allocate send msg)");
+ uifw_warn("hs_lib_handle_onscreen: ERROR(allocate send msg)");
return;
}
send->type = ICO_HS_PROTOCOL_TYPE_CM;
static void
hs_lib_realsend(hs_lib_msg_t *msg)
{
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *pt = &buf[LWS_SEND_BUFFER_PRE_PADDING];
- int n;
-
- strcpy((char*)pt, msg->data);
-
- uifw_trace("hs_lib_realsend: send(wsi=%x, type=h:%d(m:%d), len=%d, msg=%s)",
- msg->handle->wsi, msg->handle->type, msg->type, msg->len, msg->data);
- n = libwebsocket_write(msg->handle->wsi, pt, strlen((char *)pt),
- LWS_WRITE_TEXT);
-
- if (n < 0) {
- uifw_warn("hs_lib_realsend: ERROR(fail to write ws)");
- }
+ uifw_trace("hs_lib_realsend: send(ctx=%x(%d), type=h:%d(m:%d), len=%d, msg=%s)",
+ msg->handle->uws_context, msg->handle->id,
+ msg->handle->type, msg->type, msg->len, msg->data);
+ ico_uws_send(msg->handle->uws_context, msg->handle->id,
+ (unsigned char *)msg->data, msg->len);
hs_lib_free_msg(msg);
- uifw_warn("hs_lib_realsend: Leave(send len = %d)", n);
+ uifw_trace("hs_lib_realsend: Leave");
+#if 0 /* no need on websockets 1.2 */
usleep(200);
+#endif
+ return;
}
/*--------------------------------------------------------------------------*/
hs_lib_msg_t *msg;
hs_lib_handle_t *handle;
- uifw_trace("hs_lib_put_sendmsg: Enter");
+ uifw_trace("hs_lib_put_sendmsg: Enter(%d:%s)", send->type, send->data);
handle = hs_handles;
while (handle) {
if (handle) {
send->handle = handle;
- uifw_trace("hs_lib_put_sendmsg: libwebsocket_callback_on_writable"
- "(wsi_ctx=%x, wsi=%x", handle->wsi_context, handle->wsi);
- libwebsocket_callback_on_writable(handle->wsi_context, handle->wsi);
+ uifw_trace("hs_lib_put_sendmsg: hs_lib_set_mode_poll_fd"
+ "(uws_ctx=%08x, id=%08x", handle->uws_context, handle->id);
+ hs_lib_set_mode_poll_fd(handle->fd, EPOLLOUT);
hs_lib_com_dispatch(handle, 0);
}
}
while (handle) {
- uifw_warn("hs_lib_com_dispatch: wsi=%x", handle->wsi_context);
- if (libwebsocket_service(handle->wsi_context, timeoutms) < 0) {
- uifw_warn("hs_lib_com_dispatch: fd=%d is done", handle->fd);
- }
+ ico_uws_service(handle->uws_context);
/* treate received buffer */
msg = hs_lib_get_recvmsg();
hs_lib_poll_fd_event(hs_lib_poll_t *poll, int flags)
{
hs_lib_handle_t *handle = poll->handle;
+ hs_lib_msg_t *msg;
- uifw_trace("hs_lib_ecore_fdevent: Enter(flags=%08x)", flags);
+ uifw_trace("hs_lib_poll_fd_event: Enter(handle=%08x, poll=%08x flags=%08x)",
+ (int)handle, (int)poll, flags);
/* try to ws service */
hs_lib_com_dispatch(handle, 0);
/* control polling fd's event? */
+ if ((flags & EPOLLOUT) && (handle != NULL)) {
+ hs_lib_realsend(hs_lib_get_sendmsg(handle->type));
+
+ hs_lib_com_dispatch(handle, 0);
+
+ hs_lib_clear_mode_poll_fd(handle->fd, EPOLLOUT);
+ /* check send queue */
+ msg = hs_send_msg;
+ while (msg) {
+ if (msg->handle->fd == handle->fd) {
+ hs_lib_set_mode_poll_fd(handle->fd, EPOLLOUT);
+ break;
+ }
+ msg = msg->next;
+ }
+ }
return;
}
uifw_trace("hs_lib_ecore_fdevent: Enter");
- flags
- = (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ))
- ? EPOLLIN
- : 0;
+ flags =
+ (ecore_main_fd_handler_active_get(handler, ECORE_FD_READ)) ? EPOLLIN : 0;
if (ecore_main_fd_handler_active_get(handler, ECORE_FD_WRITE)) {
- flags |= ECORE_FD_WRITE;
+ flags |= EPOLLOUT;
}
if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR)) {
flags |= EPOLLERR;
Ecore_Fd_Handler_Flags flags;
for (ii = 0; ii < num_fds; ii++) {
+ uifw_trace("hs_lib_control_fd: (handle=%08x, fd=%d, flg=%08x)",
+ (int)fd_ctl[ii]->handle, fd_ctl[ii]->fd, fd_ctl[ii]->flags);
if (fd_ctl[ii]->flags) {
flags = (fd_ctl[ii]->flags & EPOLLIN) ? ECORE_FD_READ : 0;
if (fd_ctl[ii]->flags & EPOLLOUT) {
hs_lib_add_poll_fd(int fd, int flags)
{
hs_lib_poll_t *poll;
- hs_lib_poll_t *fds[0];
+ hs_lib_poll_t *fds[1];
hs_lib_handle_t *handle;
/* get management table */
}
poll->flags = flags;
- /* if the fd is same as wsi_context, set the handle */
+ /* if the fd is same as uws_context, set the handle */
handle = hs_handles;
while (handle) {
if (handle->fd == fd)
hs_lib_del_poll_fd(int fd)
{
hs_lib_poll_t *poll;
- hs_lib_poll_t *fds[0];
+ hs_lib_poll_t *fds[1];
/* get management table */
poll = hs_polls;
hs_lib_set_mode_poll_fd(int fd, int flags)
{
hs_lib_poll_t *poll;
- hs_lib_poll_t *fds[0];
+ hs_lib_poll_t *fds[1];
/* get management table */
poll = hs_polls;
while (poll) {
if (poll->fd == fd) {
+uifw_trace("hs_lib_set_mode_poll_fd: fd=%d (%d)", poll->fd, fd);
/* control fds */
poll->flags |= flags;
fds[0] = poll;
hs_lib_clear_mode_poll_fd(int fd, int flags)
{
hs_lib_poll_t *poll;
- hs_lib_poll_t *fds[0];
+ hs_lib_poll_t *fds[1];
/* get management table */
poll = hs_polls;
/*--------------------------------------------------------------------------*/
/*
- * @brief hs_lib_callback_http
- * Connection status is notified from libwebsockets.
+ * @brief hs_lib_callback_uws
+ * callback function from UWS
*
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_lib_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- int fd;
-
- uifw_trace("hs_lib_callback_http: context=%p", context);
- uifw_trace("HS-REASON %d", reason);
-
- fd = libwebsocket_get_socket_fd(wsi);
- switch (reason) {
- case LWS_CALLBACK_ADD_POLL_FD:
- uifw_trace("LWS_CALLBACK_ADD_POLL_FD: wsi_fd=%d fd=%d flg=%08x", fd,
- (int)(long)user, (int)len);
- (void)hs_lib_add_poll_fd(fd, (int)len);
- break;
-
- case LWS_CALLBACK_DEL_POLL_FD:
- uifw_trace("LWS_CALLBACK_DEL_POLL_FD: wsi_fd=%d fd=%d flg=%08x", fd,
- (int)(long)user, (int)len);
- hs_lib_del_poll_fd(fd);
- break;
-
- case LWS_CALLBACK_SET_MODE_POLL_FD:
- uifw_trace("LWS_CALLBACK_SET_MODE_POLL_FD: wsi_fd=%d fd=%d flg=%08x",
- fd, (int)(long)user, (int)len);
- hs_lib_set_mode_poll_fd(fd, (int)len);
- break;
-
- case LWS_CALLBACK_CLEAR_MODE_POLL_FD:
- uifw_trace("LWS_CALLBACK_CLEAR_MODE_POLL_FD: wsi_fd=%d fd=%d flg=%08x",
- fd, (int)(long)user, (int)len);
- hs_lib_clear_mode_poll_fd(fd, (int)len);
- break;
-
- default:
- break;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief hs_lib_callback_command
- * this callback function is notified from libwebsockets
- * command protocol
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @param[in] context context
+ * @param[in] event event kinds
+ * @param[in] id client id
+ * @param[in] detail event detail
+ * @param[in] data user data
+ * @return none
*/
/*--------------------------------------------------------------------------*/
-static int
-hs_lib_callback_command(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
+static void
+hs_lib_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event,
+ const void *id,
+ const ico_uws_detail *detail,
+ void *data)
{
- int fd;
+ char *in;
+ int len;
hs_lib_handle_t *handle;
- hs_lib_poll_t *poll;
hs_lib_msg_t *msg;
- uifw_trace("hs_lib_callback_command: Enter(ctx=%p, wsi_fd=%d, reason=%d",
- context, libwebsocket_get_socket_fd(wsi), reason);
-
- fd = libwebsocket_get_socket_fd(wsi);
- if (reason == LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION) {
- /* connect from client. the client must exist only one */
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION(fd=%d)", fd);
- handle = hs_handles;
- while (handle) {
- if (handle->fd == fd)
- break;
- handle = handle->next;
- }
- if (!handle) {
- handle = hs_lib_alloc_handle();
- if (!handle) {
- uifw_warn("hs_lib_callback_command: ERROR(allocate handle)");
- }
- }
- handle->wsi_context = hs_wsicontext;
- handle->wsi = wsi;
- handle->fd = fd;
- handle->type = ICO_HS_PROTOCOL_TYPE_CM;
-
- poll = hs_polls;
- while (poll) {
- if (poll->fd == handle->fd) {
- poll->handle = handle;
- handle->poll = poll;
- }
- poll = poll->next;
- }
- return 0;
- }
+ uifw_trace("hs_lib_callback_uws: context=%08x id=%08x", (int)context, (int)id);
handle = hs_handles;
while (handle) {
- if (handle->wsi == wsi)
+ if (handle->id == id)
break;
handle = handle->next;
}
-
- switch (reason) {
- case LWS_CALLBACK_ESTABLISHED:
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_ESTABLISHED(wsi=%x)", wsi);
- handle->service_on = 1;
-
- msg = hs_lib_alloc_msg(HS_REQ_ANS_HELLO, strlen(HS_REQ_ANS_HELLO));
- if (!msg) {
- uifw_warn("hs_lib_callback_command: ERROR(allocate recv msg)");
- break;
- }
- msg->type = ICO_HS_PROTOCOL_TYPE_CM;
- msg->handle = handle;
-
- hs_lib_put_recvmsg(msg);
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_ESTABLISHED: Leave");
- break;
-
- case LWS_CALLBACK_RECEIVE:
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_RECEIVE:(len=%d \"%s\")", len, in);
- if (strlen(in) == 0)
- break;
-
- msg = hs_lib_alloc_msg((char *)in, len);
- if (!msg) {
- uifw_warn("hs_lib_callback_command: ERROR(allocate recv msg)");
- break;
- }
- msg->type = ICO_HS_PROTOCOL_TYPE_CM;
- msg->handle = handle;
-
- hs_lib_put_recvmsg(msg);
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_RECEIVE: Leave");
- break;
-
- case LWS_CALLBACK_CLOSED:
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_CLOSED:(wsi=%x)", wsi);
- hs_lib_free_handle(handle);
- break;
-
- case LWS_CALLBACK_SERVER_WRITEABLE:
- uifw_trace("hs_lib_callback_command: "
- "LWS_CALLBACK_SERVER_WRITEABLE:(wsi=%x)", wsi);
- hs_lib_realsend(hs_lib_get_sendmsg(ICO_HS_PROTOCOL_TYPE_CM));
-
- default:
- uifw_trace("HS-REASON %d", reason);
- break;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief hs_lib_callback_statusbar
- * this callback function is notified from libwebsockets
- * statusbar protocol
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_lib_callback_statusbar(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len)
-{
- int fd;
- hs_lib_handle_t *handle;
- hs_lib_poll_t *poll;
- hs_lib_msg_t *msg;
-
- uifw_trace("hs_lib_callback_statusbar: Enter(ctx=%p, wsi_fd=%d, reason=%d",
- context, libwebsocket_get_socket_fd(wsi), reason);
-
- fd = libwebsocket_get_socket_fd(wsi);
- if (reason == LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION) {
- /* connect from client. the client must exist only one */
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION(fd=%d)", fd);
- handle = hs_handles;
- while (handle) {
- if (handle->fd == fd)
- break;
- handle = handle->next;
- }
+ if (!handle) {
+ handle = hs_lib_alloc_handle();
if (!handle) {
- handle = hs_lib_alloc_handle();
- if (!handle) {
- uifw_warn("hs_lib_callback_statusbar: ERROR(allocate handle)");
- }
- }
- handle->wsi_context = hs_wsicontext;
- handle->wsi = wsi;
- handle->fd = fd;
- handle->type = ICO_HS_PROTOCOL_TYPE_SB;
-
- poll = hs_polls;
- while (poll) {
- if (poll->fd == handle->fd) {
- poll->handle = handle;
- handle->poll = poll;
- }
- poll = poll->next;
+ uifw_warn("hs_lib_callback_uws: ERROR(allocate handle)");
+ return;
}
- return 0;
- }
-
- handle = hs_handles;
- while (handle) {
- if (handle->wsi == wsi)
- break;
- handle = handle->next;
- }
-
- switch (reason) {
- case LWS_CALLBACK_ESTABLISHED:
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_ESTABLISHED(wsi=%x)", wsi);
+ handle->uws_context = (struct ico_uws_context *)context;
+ handle->id = (void *)id;
handle->service_on = 1;
- break;
-
- case LWS_CALLBACK_RECEIVE:
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_RECEIVE:(len=%d \"%s\")", len, in);
-
- if (strlen(in) == 0)
- break;
-
- msg = hs_lib_alloc_msg((char *)in, len);
- if (!msg) {
- uifw_warn("hs_lib_callback_statusbar: ERROR(allocate recv msg)");
- break;
- }
- msg->type = ICO_HS_PROTOCOL_TYPE_SB;
- msg->handle = handle;
+ }
- hs_lib_put_recvmsg(msg);
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_RECEIVE: Leave");
+ switch (event) {
+ case ICO_UWS_EVT_OPEN:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_OPEN(id=%08x)", (int)id);
break;
- case LWS_CALLBACK_CLOSED:
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_CLOSED:(wsi=%x)", wsi);
+ case ICO_UWS_EVT_CLOSE:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_CLOSE(id=%08x)", (int)id);
hs_lib_free_handle(handle);
break;
- case LWS_CALLBACK_SERVER_WRITEABLE:
- uifw_trace("hs_lib_callback_statusbar: "
- "LWS_CALLBACK_SERVER_WRITEABLE:(wsi=%x)", wsi);
- hs_lib_realsend(hs_lib_get_sendmsg(ICO_HS_PROTOCOL_TYPE_SB));
-
- default:
- uifw_trace("HS-REASON %d", reason);
- break;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/*
- * @brief hs_lib_callback_onscreen
- * this callback function is notified from libwebsockets
- * statusbar protocol
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-hs_lib_callback_onscreen(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- int fd;
- hs_lib_handle_t *handle;
- hs_lib_poll_t *poll;
- hs_lib_msg_t *msg;
-
- uifw_trace("hs_lib_callback_onscreen: Enter(ctx=%p, wsi_fd=%d, reason=%d",
- context, libwebsocket_get_socket_fd(wsi), reason);
-
- fd = libwebsocket_get_socket_fd(wsi);
- if (reason == LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION) {
- /* connect from client. the client must exist only one */
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION(fd=%d)", fd);
- handle = hs_handles;
- while (handle) {
- if (handle->fd == fd)
- break;
- handle = handle->next;
+ case ICO_UWS_EVT_RECEIVE:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_RECEIVE(id=%08x, msg=%s, len=%d)",
+ (int)id, (char *)detail->_ico_uws_message.recv_data,
+ detail->_ico_uws_message.recv_len);
+ in = (char *)detail->_ico_uws_message.recv_data;
+ len = detail->_ico_uws_message.recv_len;
+ if (len < 4) {
+ break;
}
- if (!handle) {
- handle = hs_lib_alloc_handle();
- if (!handle) {
- uifw_warn("hs_lib_callback_onscreen: ERROR(allocate handle)");
- }
+ if (strncmp(in, ICO_HS_MSG_HEAD_CM, 3) == 0) {
+ handle->type = ICO_HS_PROTOCOL_TYPE_CM;
}
- handle->wsi_context = hs_wsicontext;
- handle->wsi = wsi;
- handle->fd = fd;
- handle->type = ICO_HS_PROTOCOL_TYPE_OS;
-
- poll = hs_polls;
- while (poll) {
- if (poll->fd == handle->fd) {
- poll->handle = handle;
- handle->poll = poll;
- }
- poll = poll->next;
+ else if (strncmp(in, ICO_HS_MSG_HEAD_OS, 3) == 0) {
+ handle->type = ICO_HS_PROTOCOL_TYPE_OS;
}
- return 0;
- }
-
- handle = hs_handles;
- while (handle) {
- if (handle->wsi == wsi)
- break;
- handle = handle->next;
- }
-
- switch (reason) {
- case LWS_CALLBACK_ESTABLISHED:
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_ESTABLISHED(wsi=%x)", wsi);
- handle->service_on = 1;
- break;
-
- case LWS_CALLBACK_RECEIVE:
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_RECEIVE:(len=%d \"%s\")", len, in);
-
- if (strlen(in) == 0)
+ else if (strncmp(in, ICO_HS_MSG_HEAD_SB, 3) == 0) {
+ handle->type = ICO_HS_PROTOCOL_TYPE_SB;
+ }
+ else if (strncmp(in, ICO_HS_MSG_HEAD_APP, 3) == 0) {
+ handle->type = ICO_HS_PROTOCOL_TYPE_APP;
+ }
+ else {
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_RECEIVE(unknown)");
break;
+ }
- msg = hs_lib_alloc_msg((char *)in, len);
+ msg = hs_lib_alloc_msg(&in[4], len - 4);
if (!msg) {
- uifw_warn("hs_lib_callback_onscreen: ERROR(allocate recv msg)");
+ uifw_trace("hs_lib_callback_uws: cannot allocate msg");
break;
}
- msg->type = ICO_HS_PROTOCOL_TYPE_OS;
+ msg->type = handle->type;
msg->handle = handle;
hs_lib_put_recvmsg(msg);
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_RECEIVE: Leave");
- break;
- case LWS_CALLBACK_CLOSED:
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_CLOSED:(wsi=%x)", wsi);
- hs_lib_free_handle(handle);
+ break;
+
+ case ICO_UWS_EVT_ERROR:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_ERROR(id=%08x, err=%d)",
+ (int)id, detail->_ico_uws_error.code);
break;
- case LWS_CALLBACK_SERVER_WRITEABLE:
- uifw_trace("hs_lib_callback_onscreen: "
- "LWS_CALLBACK_SERVER_WRITEABLE:(wsi=%x)", wsi);
- hs_lib_realsend(hs_lib_get_sendmsg(ICO_HS_PROTOCOL_TYPE_OS));
+ case ICO_UWS_EVT_ADD_FD:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_ADD_FD(id=%08x, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
+ handle->fd = detail->_ico_uws_fd.fd;
+ (void)hs_lib_add_poll_fd(detail->_ico_uws_fd.fd, EPOLLIN);
+ break;
+ case ICO_UWS_EVT_DEL_FD:
+ uifw_trace("hs_lib_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
+ hs_lib_del_poll_fd(detail->_ico_uws_fd.fd);
break;
default:
- uifw_trace("hs_lib_callback_onscreen: HS-REASON %d", reason);
break;
}
-
- return 0;
}
/*--------------------------------------------------------------------------*/
/*
- * @brief hs_lib_callback_app
- * this callback function is notified from libwebsockets
- * application protocol
+ * @brief hs_lib_setup_server
+ * setup server
*
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @param[in] uri URI
+ * @param[in] protocol websocket's protocol name
+ * @param[in] callback callback function
+ * @return handle
+ * @retval >0 success
+ * @retval NULL error
*/
/*--------------------------------------------------------------------------*/
-static int
-hs_lib_callback_app(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
+static hs_lib_handle_t *
+hs_lib_setup_server(const char *uri, const char *protocol, ico_uws_evt_cb callback)
{
- int fd;
- hs_lib_handle_t *handle;
- hs_lib_poll_t *poll;
- hs_lib_msg_t *msg;
-
- uifw_trace("hs_lib_callback_app: Enter(ctx=%p, wsi_fd=%d, reason=%d",
- context, libwebsocket_get_socket_fd(wsi), reason);
+ int ret;
+ struct ico_uws_context *context = NULL;
+ hs_lib_handle_t *handle = NULL;
- fd = libwebsocket_get_socket_fd(wsi);
- if (reason == LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION) {
- /* connect from client.*/
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION(fd=%d)", fd);
- handle = hs_handles;
- while (handle) {
- if (handle->fd == fd)
- break;
- handle = handle->next;
- }
- if (!handle) {
- handle = hs_lib_alloc_handle();
- if (!handle) {
- uifw_warn("hs_lib_callback_app: ERROR(allocate handle)");
- }
- }
- handle->wsi_context = hs_wsicontext;
- handle->wsi = wsi;
- handle->fd = fd;
- handle->type = ICO_HS_PROTOCOL_TYPE_APP;
-
- poll = hs_polls;
- while (poll) {
- if (poll->fd == handle->fd) {
- poll->handle = handle;
- handle->poll = poll;
- }
- poll = poll->next;
- }
- return 0;
+ handle = hs_lib_alloc_handle();
+ if (! handle) {
+ uifw_trace("hs_lib_setup_server: cannot allocate handle");
+ return NULL;
}
- handle = hs_handles;
- while (handle) {
- if (handle->wsi == wsi)
- break;
- handle = handle->next;
+ /* create context */
+ context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
+ handle->uws_context = context;
+ if (! context) {
+ uifw_trace("hs_lib_setup_server: cannot create context");
+ hs_lib_free_handle(handle);
+ return NULL;
}
+ uifw_trace("hs_lib_setup_server: create ctx=%08x", (int)context);
+ ico_uws_service(context);
- switch (reason) {
- case LWS_CALLBACK_ESTABLISHED:
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_ESTABLISHED(wsi=%x)", wsi);
- handle->service_on = 1;
- break;
-
- case LWS_CALLBACK_RECEIVE:
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_RECEIVE:(len=%d \"%s\")", len, in);
-
- if (strlen(in) == 0)
- break;
-
- msg = hs_lib_alloc_msg((char *)in, len);
- if (!msg) {
- uifw_warn("hs_lib_callback_app: ERROR(allocate recv msg)");
- break;
- }
- msg->type = ICO_HS_PROTOCOL_TYPE_APP;
- msg->handle = handle;
-
- hs_lib_put_recvmsg(msg);
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_RECEIVE: Leave");
- break;
-
- case LWS_CALLBACK_CLOSED:
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_CLOSED:(wsi=%x)", wsi);
+ /* set callback */
+ ret = ico_uws_set_event_cb(context, callback, (void *)handle);
+ if (ret != ICO_UWS_ERR_NONE) {
+ uifw_trace("hs_lib_setup_server: cannnot set callback");
hs_lib_free_handle(handle);
- break;
-
- case LWS_CALLBACK_SERVER_WRITEABLE:
- uifw_trace("hs_lib_callback_app: "
- "LWS_CALLBACK_SERVER_WRITEABLE:(wsi=%x)", wsi);
- hs_lib_realsend(hs_lib_get_sendmsg(ICO_HS_PROTOCOL_TYPE_APP));
-
- default:
- uifw_trace("hs_lib_callback_app: HS-REASON %d", reason);
- break;
+ return NULL;
}
- return 0;
+ return handle;
}
/*--------------------------------------------------------------------------*/
int
hs_lib_main(int port)
{
- int opts = 0;
- hs_lib_handle_t *handle;
-
- handle = hs_lib_alloc_handle();
- handle->wsi_context
- = libwebsocket_create_context(ICO_HS_WS_PORT, NULL, protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, opts);
- if (handle->wsi_context == NULL) {
- uifw_warn(
- "home_screen_lib_main: ERROR(libwebsocket_create_context failed.)");
+ char uri[ICO_HS_TEMP_BUF_SIZE];
+ hs_lib_handle_t *handle = NULL;
+
+ /* set up URI ":PORT" */
+ sprintf(uri, ":%d", port);
+
+ /* set up server */
+ handle = hs_lib_setup_server(uri, ICO_HS_PROTOCOL, hs_lib_callback_uws);
+ if ((handle == NULL) || (handle->uws_context == NULL)) {
+ uifw_warn("home_screen_lib_main: ERROR(hs_lib_setup_server failed.)");
return ICO_HS_ERR;
}
- hs_wsicontext = handle->wsi_context;
+ hs_wsicontext = handle->uws_context;
+
+ ico_uws_service(hs_wsicontext);
return ICO_HS_OK;
}
/* HomeScreen APP: BG or TOUCH */
ico_uxf_window_resize(dd.window.window, dispW, dispH
- ICO_HS_SIZE_SB_HEIGHT);
- ico_uxf_window_move(dd.window.window, 0, ICO_HS_SIZE_SB_HEIGHT);
+ ico_uxf_window_move(dd.window.window, 0, ICO_HS_SIZE_SB_HEIGHT, 0);
ico_uxf_window_show(dd.window.window);
if (winAttr.subwindow > 0) {
/* set layer of HomeScreen TouchPanel window */
ico_uxf_window_layer(dd.window.window, HS_LAYER_ONSCREEN);
/* show status bar */
ico_uxf_window_show(dd.window.window);
- ico_uxf_window_move(dd.window.window, 0, 0);
+ ico_uxf_window_move(dd.window.window, 0, 0, 0);
ico_uxf_window_screen_size_get(&dispW, &dispH);
ico_uxf_window_resize(dd.window.window, dispW, ICO_HS_SIZE_SB_HEIGHT);
}
}
else if (ev == ICO_UXF_EVENT_ACTIVEWINDOW) {
/* set active window */
+ uifw_trace("hs_uxf_event: window=%08x active=%x", dd.window.window, dd.window.active);
if (dd.window.active == ICO_UXF_WINDOW_SELECT) {
if (ico_uxf_window_attribute_get(dd.window.window, &winAttr) == ICO_UXF_EOK) {
if ((strncmp(winAttr.process, hs_name_homescreen, ICO_UXF_MAX_PROCESS_NAME)
}
else {
ico_uxf_window_active(dd.window.window,
- ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
+ ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
ico_uxf_window_raise(dd.window.window);
ico_syc_apc_active(winAttr.process);
}
}
+ else {
+ ico_uxf_window_active(dd.window.window, ICO_UXF_WINDOW_POINTER_ACTIVE |
+ ICO_UXF_WINDOW_KEYBOARD_ACTIVE);
+ }
}
}
}
}
}
ico_uxf_window_move(window.window, hs_app_screen_window[idx].move_x,
- hs_app_screen_window[idx].move_y);
+ hs_app_screen_window[idx].move_y, 0);
ico_uxf_window_resize(window.window,
hs_app_screen_window[idx].resize_w,
hs_app_screen_window[idx].resize_h);
hs_app_screen_window[ii].resize_h);
ico_uxf_window_move(window.window,
hs_app_screen_window[ii].move_x,
- hs_app_screen_window[ii].move_y);
+ hs_app_screen_window[ii].move_y, 0);
ico_uxf_window_show(window.window);
if (! appConf) {
ico_uxf_window_layer(window.window, HS_LAYER_APPLICATION);
hs_app_screen_window[idx].resize_h);
ico_uxf_window_move(window.window,
hs_app_screen_window[idx].move_x,
- hs_app_screen_window[idx].move_y);
+ hs_app_screen_window[idx].move_y, 0);
if (! appConf) {
ico_uxf_window_layer(window.window, HS_LAYER_APPLICATION);
/* show application layer */
/* move application window to HomeScreen layer */
ico_uxf_window_layer(window.window, HS_LAYER_HOMESCREEN);
ico_uxf_window_resize(window.window, tinfo->size_x, tinfo->size_y);
- ico_uxf_window_move(window.window, tinfo->coord_x, tinfo->coord_y);
+ ico_uxf_window_move(window.window, tinfo->coord_x, tinfo->coord_y, 0);
ico_uxf_window_visible_raise(window.window, 1, 1);
}
}
/* operation sound */
hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
- uifw_trace("hs_click_applist: Leave");
/* show Touch layer */
ico_uxf_layer_visible(HS_DISPLAY_HOMESCREEN, HS_LAYER_TOUCH, 1);
/* show OnScreen windows */
hs_show_onscreen();
+ uifw_trace("hs_click_applist: Leave");
return 1;
}
hs_get_image_path(path, sizeof(path));
snprintf(img, sizeof(img), "%s/%s", path, fname);
}
+ uifw_trace("hs_add_bg_image: image path=%s", img);
ico_uxf_window_screen_size_get(&dispW, &dispH);
-
canvas = evas_object_image_filled_add(canvas_bg);
evas_object_image_file_set(canvas, img, NULL);
err = evas_object_image_load_error_get(canvas);
if (err != EVAS_LOAD_ERROR_NONE) {
- uifw_trace("hs_add_bg_image: backgound image is not exist");
+ uifw_warn("hs_add_bg_image: backgound image(%s) is not exist", img);
}
else {
evas_object_image_fill_set(canvas, 0, 0, dispW, dispH - ICO_HS_SIZE_SB_HEIGHT);
evas_object_resize(canvas, dispW, dispH - ICO_HS_SIZE_SB_HEIGHT);
evas_object_show(canvas);
}
-
return;
}
/* get pkg name */
char *pkg;
- printf("main: %s: %s", getenv("HOME"), getenv("PKG_NAME"));
pkg = getenv("PKG_NAME");
memset(hs_name_homescreen, 0, ICO_UXF_MAX_PROCESS_NAME + 1);
if (pkg) {
hs_command_req[ii].input.del_app.input = IGNORE;
}
- g_type_init();
-
parser = json_parser_new();
error = NULL;
if (target >= 0) {
st = ico_uxf_window_move(target,
hs_command_req[ii].window[jj].move.x,
- hs_command_req[ii].window[jj].move.y);
+ hs_command_req[ii].window[jj].move.y, 0);
}
uifw_debug("FORM move %d %d %d = %d", target,
hs_command_req[ii].window[jj].move.x,
#include "home_screen_res.h"
#include "home_screen_conf.h"
-#include <libwebsockets.h>
+#include <ico_uws.h>
+
#include <bundle.h>
/*============================================================================*/
#define ICO_ONS_CMD_WAIT (1)
#define ICO_ONS_NO_WAIT (2)
-typedef struct _ons_msg ons_msg_t;
-struct _ons_msg {
- ons_msg_t *next;
- char *data;
- int len;
-};
-
/*============================================================================*/
/* static(internal) functions prototype */
/*============================================================================*/
+static void ons_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data);
static int ons_loadinons_edje_file(const char *edje_file);
static void ons_event_message(char *format, ...);
-static ons_msg_t *ons_alloc_sendmsg(char *data, int len);
-static void ons_free_msgst(ons_msg_t *msg);
-static ons_msg_t *ons_get_sendmsg(void);
-static int ons_put_sendmsg(ons_msg_t *send);
static char *ons_edje_parse_str(void *in, int arg_num);
-static int ons_callback_http(
- struct libwebsocket_context *context, struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user, void *in,
- size_t len);
-static int ons_callback_onscreen(
- struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
static void ons_create_context(void);
static Eina_Bool ons_ecore_event(void *data);
static void ons_on_destroy(Ecore_Evas *ee);
/*============================================================================*/
static int ons_ws_port = ICO_HS_WS_PORT;
static int ons_ws_connected = 0;
-static struct libwebsocket_context *ons_ws_context = NULL;
-static struct libwebsocket *ons_wsi_mirror = NULL;
+static struct ico_uws_context *ons_uws_context = NULL;
+static void *ons_uws_id = NULL;
static char ons_edje_str[ICO_ONS_BUF_SIZE];
static Ecore_Evas *ons_window; /* ecore-evas object */
static int ons_applist_idx = 0; /* only for applist, it's index */
static int ons_app_cnt = 0; /* only for applist. a number of app to listed */
-static ons_msg_t *ons_free_msg = NULL;
-static ons_msg_t *ons_send_msg = NULL;
-
-static int ons_command_wait = ICO_ONS_NO_WAIT;
-
-static struct libwebsocket_protocols ws_protocols[] = {
- {
- "http-only",
- ons_callback_http,
- 0
- },
- {
- "onscreen-protocol",
- ons_callback_onscreen,
- 0,
- },
- {
- /* end of list */
- NULL,
- NULL,
- 0
- }
-};
+static int ons_wait_reply = ICO_ONS_NO_WAIT;
/*============================================================================*/
/* functions */
ons_event_message(char *format, ...)
{
va_list list;
- char message[ICO_HS_TEMP_BUF_SIZE];
- ons_msg_t *send;
+ unsigned char message[ICO_HS_TEMP_BUF_SIZE];
va_start(list, format);
- vsnprintf(message, sizeof(message), format, list);
+ vsnprintf((char *)message, sizeof(message), format, list);
va_end(list);
uifw_trace("OnScreen: ons_event_message %s", message);
- send = ons_alloc_sendmsg(message, strlen(message));
- if (!send) {
- uifw_warn("ons_event_message: ERROR(allocate send msg)");
- }
- else {
- ons_put_sendmsg(send);
- }
+ ico_uws_send(ons_uws_context, ons_uws_id, message, strlen((char *)message));
return;
}
-/*--------------------------------------------------------------------------*/
-/**
- * @brief ons_get_sendmsg
- * get the send message from the send buffer.
- *
- * @param none
- * @return send buffer address
- * @retval > 0 success
- * @retval NULL error
- */
-/*--------------------------------------------------------------------------*/
-static ons_msg_t *
-ons_get_sendmsg(void)
-{
- ons_msg_t *msg;
-
- msg = ons_send_msg;
- if (msg) {
- ons_send_msg = msg->next;
- msg->next = NULL;
- }
-
- return msg;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief ons_put_sendmsg
- * put the send message to the send queue end.
- *
- * @param[in] data send message
- * @return result
- * @retval ICO_HS_OK success
- * @retval ICO_HS_ERR error
- */
-/*--------------------------------------------------------------------------*/
-static int
-ons_put_sendmsg(ons_msg_t *send)
-{
- ons_msg_t *msg;
-
- uifw_trace("ons_put_sendmsg: Enter");
-
- msg = ons_send_msg;
- while (msg) {
- if (!msg->next) {
- break;
- }
- msg = msg->next;
- }
- if (!msg) {
- ons_send_msg = send;
- }
- else {
- msg->next = send;
- }
-
- if (ons_ws_context && ons_wsi_mirror) {
- uifw_trace("ons_put_sendmsg: libwebsocket_callback_on_writable"
- "(wsi_ctx=%x, wsi=%x", ons_ws_context, ons_wsi_mirror);
- libwebsocket_callback_on_writable(ons_ws_context, ons_wsi_mirror);
- }
- else {
- uifw_trace("ons_put_sendmsg: Leave(do not have wsi)");
- return ICO_HS_ERR;
- }
-
- uifw_trace("ons_put_sendmsg: Leave");
-
- return ICO_HS_OK;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief ons_free_msgst
- * free the message structure
- *
- * @param[in] msg message to free
- * @return none
- */
-/*--------------------------------------------------------------------------*/
-static void
-ons_free_msgst(ons_msg_t *msg)
-{
- if (!msg) {
- return;
- }
-
- if (msg->data) {
- free(msg->data);
- }
-
- memset(msg, 0, sizeof(ons_msg_t));
-
- msg->next = ons_free_msg;
- ons_free_msg = msg;
-
- return;
-}
-
-/*--------------------------------------------------------------------------*/
-/**
- * @brief ons_alloc_sendmsg
- * Allocate a send message buffer.
- *
- * @param[in] data data
- * @param[in] len data length
- * @return address
- * @retval > 0 success
- * @retval NULL error
- */
-/*--------------------------------------------------------------------------*/
-static ons_msg_t *
-ons_alloc_sendmsg(char *data, int len)
-{
- ons_msg_t *msg;
-
- if (!ons_free_msg) {
- msg = malloc(sizeof(ons_msg_t));
- if (!msg) {
- return NULL;
- }
- }
- else {
- msg = ons_free_msg;
- ons_free_msg = ons_free_msg->next;
- }
- memset(msg, 0, sizeof(ons_msg_t));
-
- msg->len = len;
- msg->data = strdup(data);
- if (!msg->data) {
- free(msg);
- return NULL;
- }
-
- return msg;
-}
-
static char *
ons_edje_parse_str(void *in, int arg_num)
{
/*--------------------------------------------------------------------------*/
/*
- * @brief ons_callback_http
- * Connection status is notified from libwebsockets.
+ * @brief ons_callback_uws
+ * callback function from UWS
*
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @param[in] context context
+ * @param[in] event event kinds
+ * @param[in] id client id
+ * @param[in] detail event detail
+ * @param[in] data user data
+ * @return none
*/
/*--------------------------------------------------------------------------*/
-static int
-ons_callback_http(struct libwebsocket_context *context, struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user, void *in,
- size_t len)
+static void
+ons_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data)
{
- uifw_trace("ons_callback_http %p", context);
- uifw_trace("OS-REASON %d", reason);
- return 0;
-}
+ uifw_trace("ons_callback_uws %p", context);
+ char *in;
+
+ switch (event) {
+ case ICO_UWS_EVT_OPEN:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id);
+ ons_uws_id = (void *)id;
+ ons_event_message("%s ANS HELLO", ICO_HS_MSG_HEAD_OS);
+ break;
-/*--------------------------------------------------------------------------*/
-/*
- * @brief ons_callback_onscreen
- * this callback function is notified from libwebsockets
- * onscreen protocol
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-ons_callback_onscreen(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- int n = 0;
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
- ons_msg_t *msg;
-
- uifw_trace("ons_callback_onscreen %p", context);
-
- switch (reason) {
- case LWS_CALLBACK_CLIENT_ESTABLISHED:
- uifw_trace("OS-ESTABLISHED %x", wsi);
- ons_wsi_mirror = wsi;
- ons_event_message("ANS HELLO");
+ case ICO_UWS_EVT_CLOSE:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id);
+ ons_uws_context = NULL;
+ ons_ws_connected = 0;
+ ons_uws_id = NULL;
break;
- case LWS_CALLBACK_CLIENT_RECEIVE:
- uifw_trace("OS-RECEIVE[%d] %s", len, in);
+ case ICO_UWS_EVT_RECEIVE:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
+ (int)id, (char *)detail->_ico_uws_message.recv_data,
+ detail->_ico_uws_message.recv_len);
+ in = (char *)detail->_ico_uws_message.recv_data;
if (strlen(in) == 0)
break;
- ons_command_wait = ICO_ONS_NO_WAIT;
+ ons_wait_reply = ICO_ONS_NO_WAIT;
/* onscreen activate request */
if (strncmp("OPEN", in, 4) == 0) {
uifw_trace("%s", in);
strncpy(ons_edje_str, ons_edje_parse_str(in, 1), sizeof(ons_edje_str));
uifw_trace("ons_loadinons_edje_file: %s", &ons_edje_str[0]);
if (ons_loadinons_edje_file(&ons_edje_str[0]) == 0) {
- ons_event_message("RESULT SUCCESS");
+ ons_event_message("%s RESULT SUCCESS", ICO_HS_MSG_HEAD_OS);
}
else {
- ons_event_message("RESULT FAILED");
+ ons_event_message("%s RESULT FAILED", ICO_HS_MSG_HEAD_OS);
}
}
break;
- case LWS_CALLBACK_CLOSED:
- uifw_trace("OS-CLOSE");
- ons_wsi_mirror = NULL;
+ case ICO_UWS_EVT_ERROR:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
+ (int)id, detail->_ico_uws_error.code);
break;
- case LWS_CALLBACK_CLIENT_WRITEABLE:
- uifw_trace("LWS_CALLBACK_CLIENT_WRITEABLE:(wsi=%x)", wsi);
-
- msg = ons_get_sendmsg();
- if (msg) {
- strcpy((char *)p, msg->data);
- n = libwebsocket_write(wsi, p, strlen((char *)p), LWS_WRITE_TEXT);
- if (n < 0) {
- uifw_warn("ons_callback_onscreen: ERROR(fail to write ws)");
- }
- }
- ons_free_msgst(msg);
- if (ons_send_msg) {
- libwebsocket_callback_on_writable(context, wsi);
- }
+ case ICO_UWS_EVT_ADD_FD:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
+ break;
- usleep(200);
+ case ICO_UWS_EVT_DEL_FD:
+ uifw_trace("ons_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
break;
default:
- uifw_trace("OS-REASON %d", reason);
break;
}
- uifw_trace("ons_callback_onscreen: Leave");
-
- return 0;
+ return;
}
/*--------------------------------------------------------------------------*/
static void
ons_create_context(void)
{
- ons_ws_context
- = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
- ws_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- uifw_trace("OnScreen: ons_create_context ctx = %p", ons_ws_context);
+ int ret;
+ char uri[ICO_HS_TEMP_BUF_SIZE];
+
+ /* set up URI "ws://HOST:PORT" */
+ sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, ons_ws_port);
+
+ /* create context */
+ ons_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
+ uifw_trace("ons_create_context: ctx = %p", ons_uws_context);
ons_ws_connected = 0;
- if (ons_ws_context == NULL) {
- uifw_trace("OnScreen: libwebsocket_create_context failed.");
+ if (ons_uws_context == NULL) {
+ uifw_trace("ons_create_context: libwebsocket_create_context failed.");
}
else {
- ons_wsi_mirror = libwebsocket_client_connect(ons_ws_context,
- ICO_ONS_WS_ADDRESS, ons_ws_port, 0, "/",
- ICO_ONS_WS_ADDRESS, NULL,
- ICO_ONS_WS_PROTOCOL_NAME, -1);
- uifw_trace("OnScreen: ons_create_context wsi = %p", ons_wsi_mirror);
- if (ons_wsi_mirror != NULL) {
- ons_ws_connected = 1;
+ /* set callback */
+ ret = ico_uws_set_event_cb(ons_uws_context, ons_callback_uws, NULL);
+ if (ret != ICO_UWS_ERR_NONE) {
+ uifw_trace("ons_create_context: cannnot set callback");
}
+ ons_ws_connected = 1;
}
}
ons_ecore_event(void *data)
{
if (ons_ws_connected) {
- libwebsocket_service(ons_ws_context, 0);
+ ico_uws_service(ons_uws_context);
}
else {
- if (ons_ws_context != NULL) {
- libwebsocket_context_destroy(ons_ws_context);
- }
- ons_ws_context
- = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
- ws_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- if (ons_ws_context == NULL) {
- uifw_trace("OnScreen: libwebsocket_create_context failed.");
- }
- else {
- ons_wsi_mirror = libwebsocket_client_connect(ons_ws_context,
- ICO_ONS_WS_ADDRESS, ons_ws_port, 0,
- "/", ICO_ONS_WS_ADDRESS, NULL,
- ICO_ONS_WS_PROTOCOL_NAME, -1);
- if (ons_wsi_mirror != NULL) {
- ons_ws_connected = 1;
- }
+ if (ons_uws_context != NULL) {
+ ico_uws_close(ons_uws_context);
+ ons_uws_context = NULL;
}
+ ons_create_context();
}
return ECORE_CALLBACK_RENEW;
uifw_trace("ons_on_destroy: Enter");
ecore_main_loop_quit();
- libwebsocket_context_destroy(ons_ws_context);
+ ico_uws_close(ons_uws_context);
edje_shutdown();
}
static void
ons_touch_up_edje(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
- if (ons_command_wait == ICO_ONS_CMD_WAIT) return;
- ons_command_wait = ICO_ONS_CMD_WAIT;
+ if (ons_wait_reply == ICO_ONS_CMD_WAIT) return;
+ ons_wait_reply = ICO_ONS_CMD_WAIT;
/* get name from userdata */
if (data != NULL) {
else {
uifw_trace("OnScreen: user data is NULL");
}
- ons_event_message("TOUCH %s %s", ons_edje_str, data);
+ ons_event_message("%s TOUCH %s %s", ICO_HS_MSG_HEAD_OS, ons_edje_str, data);
/* operation sound */
hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
{
int listcnt;
- if (ons_command_wait == ICO_ONS_CMD_WAIT) return;
- ons_command_wait = ICO_ONS_CMD_WAIT;
+ if (ons_wait_reply == ICO_ONS_CMD_WAIT) return;
+ ons_wait_reply = ICO_ONS_CMD_WAIT;
if (ons_app_cnt > 0) {
listcnt = ((ons_app_cnt - 1) / ICO_ONS_APPLI_NUM) + 1;
else {
uifw_trace("OnScreen: user data is NULL");
}
- ons_event_message("TOUCH %s %s", ons_edje_str, data);
+ ons_event_message("%s TOUCH %s %s", ICO_HS_MSG_HEAD_OS, ons_edje_str, data);
/* operation sound */
hs_snd_play(hs_snd_get_filename(ICO_HS_SND_TYPE_DEFAULT));
memset(buff, 0, len);
pkg = getenv("PKG_NAME");
if (pkg) {
+ uifw_trace("hs_get_conf_path: PKG_NAME=%s", pkg);
snprintf(buff, len, manifest_path, pkg);
}
else {
pkg = getenv(ICO_UXF_TOP_ENV);
snprintf(buff, len, local_manifest_path, pkg ? pkg : local_top_path);
+ uifw_warn("hs_get_conf_path: no PKG_NAME, path=%s", buff);
}
}
#include <time.h>
#include <pthread.h>
-#include <libwebsockets.h>
#include <bundle.h>
#include <Ecore.h>
#include <Ecore_Wayland.h>
#include <Ecore_Evas.h>
+#include <ico_uws.h>
+
#include "ico_uxf.h"
#include "ico_uxf_conf.h"
#include "ico_uxf_conf_ecore.h"
#define ICO_SB_SIZE_SHTCT_W (ICO_HS_SIZE_SB_HEIGHT)
-#define ICO_SB_POS_LIST_X (ICO_HS_SIZE_SB_HEIGHT * 5)
+#define ICO_SB_POS_LIST_X (ICO_HS_SIZE_SB_HEIGHT * 1)
#define ICO_SB_POS_SHTCT1_X (ICO_SB_POS_LIST_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 2 / 2)
#define ICO_SB_POS_SHTCT2_X (ICO_SB_POS_SHTCT1_X + ICO_HS_SIZE_SB_HEIGHT + ICO_HS_SIZE_SB_HEIGHT * 1 / 2)
/* static(internal) functions prototype */
/*============================================================================*/
static void sb_on_destroy(Ecore_Evas *ee);
-static int sb_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user, void *in,
- size_t len);
-static int sb_callback_statusbar(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
+static void sb_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data);
static void sb_create_ws_context(void);
static void sb_time_hour(struct tm *t_st);
static void sb_time_min(struct tm *t_st);
static int sb_wait_reply = ICO_SB_NO_WAIT;
static int sb_ws_port = ICO_HS_WS_PORT;
static int sb_ws_connected = 0;
-static struct libwebsocket_context *sb_ws_context;
-static struct libwebsocket *sb_wsi_mirror;
+static struct ico_uws_context *sb_uws_context = NULL;
+static void *sb_uws_id = NULL;
static int sb_width = 0;
static char sb_respath[ICO_SB_BUF_SIZE];
{fname_am, }, {fname_pm, }
};
-static struct libwebsocket_protocols ws_protocols[] = {
- {
- "http-only",
- sb_callback_http,
- 0
- },
- {
- "statusbar-protocol",
- sb_callback_statusbar,
- 0,
- },
- {
- /* end of list */
- NULL,
- NULL,
- 0
- }
-};
-
/*============================================================================*/
/* functions */
/*============================================================================*/
/*--------------------------------------------------------------------------*/
/*
- * @brief sb_callback_http
- * Connection status is notified from libwebsockets.
+ * @brief sb_callback_uws
+ * callback function from UWS
*
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @param[in] context context
+ * @param[in] event event kinds
+ * @param[in] id client id
+ * @param[in] detail event detail
+ * @param[in] data user data
+ * @return none
*/
/*--------------------------------------------------------------------------*/
-static int
-sb_callback_http(struct libwebsocket_context *context, struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user, void *in,
- size_t len)
+static void
+sb_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data)
{
- uifw_trace("sb_callback_http %p", context);
- uifw_trace("SB-REASON %d", reason);
- return 0;
-}
+ uifw_trace("sb_callback_uws %p", context);
+ unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
+ char *in;
+ int len;
+
+ switch (event) {
+ case ICO_UWS_EVT_OPEN:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id);
+ sb_uws_id = (void *)id;
+ len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_SB, "ANS HELLO");
+ ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len);
+ break;
-/*--------------------------------------------------------------------------*/
-/*
- * @brief sb_callback_statusbar
- * this callback function is notified from libwebsockets
- * statusbar protocol
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
- */
-/*--------------------------------------------------------------------------*/
-static int
-sb_callback_statusbar(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- int n = 0;
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
-
- uifw_trace("sb_callback_statusbar %p", context);
-
- switch (reason) {
- case LWS_CALLBACK_CLIENT_ESTABLISHED:
- uifw_trace("SB-ESTABLISHED %x", wsi);
- sb_wsi_mirror = wsi;
- n = sprintf((char *)p, "%s", "ANS HELLO");
+ case ICO_UWS_EVT_CLOSE:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id);
+ sb_uws_context = NULL;
+ sb_ws_connected = 0;
+ sb_uws_id = NULL;
break;
- case LWS_CALLBACK_CLIENT_RECEIVE:
- uifw_trace("SB-RECEIVE[%d] %s", len, in);
- sb_wsi_mirror = wsi;
+
+ case ICO_UWS_EVT_RECEIVE:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
+ (int)id, (char *)detail->_ico_uws_message.recv_data,
+ detail->_ico_uws_message.recv_len);
+ in = (char *)detail->_ico_uws_message.recv_data;
if (strncmp("RECEIVE OK", in, 10) == 0) {
sb_wait_reply = ICO_SB_NO_WAIT;
}
else {
- n = sprintf((char *)p, "ANS %s OK", (char *)in);
+ len = sprintf((char *)msg, "%s ANS %s OK", ICO_HS_MSG_HEAD_SB, (char *)in);
+ ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len);
}
break;
- case LWS_CALLBACK_CLOSED:
- uifw_trace("SB-CLOSE");
- sb_wsi_mirror = NULL;
+
+ case ICO_UWS_EVT_ERROR:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
+ (int)id, detail->_ico_uws_error.code);
break;
- default:
- uifw_trace("SB-REASON %d", reason);
+
+ case ICO_UWS_EVT_ADD_FD:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
break;
- }
- if (n != 0) {
- n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT);
+ case ICO_UWS_EVT_DEL_FD:
+ uifw_trace("sb_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
+ break;
+
+ default:
+ break;
}
- return 0;
+ return;
}
/*--------------------------------------------------------------------------*/
static void
sb_create_ws_context(void)
{
- sb_ws_context
- = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
- ws_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- uifw_trace("sb_create_ws_context ctx = %p", sb_ws_context);
+ int ret;
+ char uri[ICO_HS_TEMP_BUF_SIZE];
+
+ /* set up URI "ws://HOST:PORT" */
+ sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, sb_ws_port);
+
+ /* create context */
+ sb_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
+ uifw_trace("sb_create_ws_context: ctx = %p", sb_uws_context);
sb_ws_connected = 0;
- if (sb_ws_context == NULL) {
- uifw_trace("libwebsocket_create_context failed.");
+ if (sb_uws_context == NULL) {
+ uifw_trace("sb_create_ws_context: libwebsocket_create_context failed.");
}
else {
- sb_wsi_mirror
- = libwebsocket_client_connect(sb_ws_context, ICO_SB_WS_ADDRESS,
- sb_ws_port, 0, "/",
- ICO_SB_WS_ADDRESS, NULL,
- ICO_SB_WS_PROTOCOL_NAME, -1);
- uifw_trace("sb_create_ws_context wsi = %p", sb_wsi_mirror);
- if (sb_wsi_mirror != NULL) {
- sb_ws_connected = 1;
+ /* set callback */
+ ret = ico_uws_set_event_cb(sb_uws_context, sb_callback_uws, NULL);
+ if (ret != ICO_UWS_ERR_NONE) {
+ uifw_trace("sb_create_ws_context: cannnot set callback");
}
+ sb_ws_connected = 1;
}
+
+ return;
}
/*--------------------------------------------------------------------------*/
sb_ecore_event(void *data)
{
if (sb_ws_connected) {
- libwebsocket_service(sb_ws_context, 0);
+ ico_uws_service(sb_uws_context);
}
else {
- if (sb_ws_context != NULL) {
- libwebsocket_context_destroy(sb_ws_context);
- }
- sb_ws_context
- = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
- ws_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
- if (sb_ws_context == NULL) {
- uifw_trace("libwebsocket_create_context failed.");
- }
- else {
- sb_wsi_mirror
- = libwebsocket_client_connect(sb_ws_context,
- ICO_SB_WS_ADDRESS,
- sb_ws_port, 0, "/",
- ICO_SB_WS_ADDRESS, NULL,
- ICO_SB_WS_PROTOCOL_NAME, -1);
- if (sb_wsi_mirror != NULL) {
- sb_ws_connected = 1;
- }
+ if (sb_uws_context != NULL) {
+ ico_uws_close(sb_uws_context);
+ sb_uws_context = NULL;
}
+ sb_create_ws_context();
}
+
return ECORE_CALLBACK_RENEW;
}
static void
sb_touch_up_shortcut(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
- int n = 0;
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+ unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
+ int len;
char *appid = (char *)data;
uifw_trace("TOUCH UP: SHORTCUT %s", appid);
if (sb_wait_reply == ICO_SB_NO_WAIT) {
- if ((sb_wsi_mirror != NULL) && (appid != NULL)) {
- n = sprintf((char *)p, "SHOW %s %s", appid, getenv("PKG_NAME"));
- libwebsocket_write(sb_wsi_mirror, p, n,
- LWS_WRITE_CLIENT_IGNORE_XOR_MASK | LWS_WRITE_TEXT);
+ if ((sb_uws_id != NULL) && (appid != NULL)) {
+ len = sprintf((char *)msg, "%s SHOW %s %s", ICO_HS_MSG_HEAD_SB, appid, getenv("PKG_NAME"));
+ ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
uifw_trace("SB: SHOW %s", appid);
sb_wait_reply = ICO_SB_WAIT_REPLY;
}
static void
sb_touch_up_applist(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
- int n = 0;
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+ unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
+ int len;
char path[ICO_HS_TEMP_BUF_SIZE];
char img[ICO_HS_TEMP_BUF_SIZE];
evas_object_show(obj);
if (sb_wait_reply == ICO_SB_NO_WAIT) {
- if (sb_wsi_mirror != NULL) {
+ if (sb_uws_id != NULL) {
hs_get_ons_edj_path(path, sizeof(path));
- n = sprintf((char *)p, "OPEN %s%s %s", path,
+ len = sprintf((char *)msg, "%s OPEN %s%s %s", ICO_HS_MSG_HEAD_SB, path,
ICO_HS_ONS_APPLI_LIST_NAME, getenv("PKG_NAME"));
- libwebsocket_write(sb_wsi_mirror, p, n,
- LWS_WRITE_CLIENT_IGNORE_XOR_MASK | LWS_WRITE_TEXT);
+ ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
uifw_trace("SB: CLICK APPLIST");
sb_wait_reply = ICO_SB_WAIT_REPLY;
}
static void
sb_touch_up_escathion(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
- int n = 0;
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512
- + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+ unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
+ int len;
char path[ICO_HS_TEMP_BUF_SIZE];
char img[ICO_HS_TEMP_BUF_SIZE];
evas_object_show(obj);
if (sb_wait_reply == ICO_SB_NO_WAIT) {
- if (sb_wsi_mirror != NULL) {
- n = sprintf((char *)p, "%s", "CLICK ESCUTCHEON 1");
- libwebsocket_write(sb_wsi_mirror, p, n,
- LWS_WRITE_CLIENT_IGNORE_XOR_MASK | LWS_WRITE_TEXT);
+ if (sb_uws_id != NULL) {
+ len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_SB, "CLICK ESCUTCHEON 1");
+ ico_uws_send(sb_uws_context, sb_uws_id, msg, len);
uifw_trace("SB: CLICK ESCUTCHEON 1");
sb_wait_reply = ICO_SB_WAIT_REPLY;
}
--- /dev/null
+#!/bin/sh
+
+# 1. Delete log file
+/bin/mkdir /var/log/ico > /dev/null 2>&1
+/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
+/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
+/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
+
+# 2. Start Device Input Controller for eGalax TouchPanel
+#/usr/bin/ico_ictl-touch_egalax -t
+/usr/bin/ico_ictl-touch_egalax
+sleep 0.3
+
+# 3. Start Weston
+/usr/bin/weston-launch -- -i0 --log=/var/log/ico/weston.log &
+sync;sync
+#sleep 0.8
+#if [ -e $XDG_RUNTIME_DIR/wayland-0 ] ; then
+# chmod 0777 $XDG_RUNTIME_DIR/wayland-0
+#fi
+
+# 4 start some daemons
+## if pulseaudio dose not start ... kick pulseaudio
+/bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
+if [ "$?" = "1" ] ; then
+ /usr/bin/pulseaudio --log-level=3 --log-target=file:/var/log/ico/pulse.log --system -D
+ sleep 0.5
+fi
+
+## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
+/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
+if [ "$?" = "1" ] ; then
+ /usr/bin/launchpad_preloading_preinitializing_daemon &
+ sleep 1
+fi
+
+# 5 start homescreen
+export PKG_NAME="org.tizen.ico.homescreen"
+/usr/bin/launch_app org.tizen.ico.homescreen &
+
ico_set_vehicleinfo_SOURCES = \
ico_set_vehicleinfo.c
-ico_set_vehicleinfo_LDADD = -lwebsockets
+ico_set_vehicleinfo_CFLAGS = $(UWS_CFLAGS)
+ico_set_vehicleinfo_LDADD = $(UWS_LIBS) -lwebsockets
ico_send_inputevent_SOURCE = \
ico_send_inputevent.c
ico_send_hscommand_SOURCES = \
ico_send_hscommand.c
-ico_send_hscommand_CFLAGS = -I../include
-ico_send_hscommand_LDADD = -lwebsockets
+ico_send_hscommand_CFLAGS = -I../include $(UWS_CFLAGS)
+#ico_send_hscommand_LDADD = $(UWS_LIBS) -lwebsockets -ldlog
+ico_send_hscommand_LDADD = $(UWS_LIBS)
#include <string.h>
#include <time.h>
#include <pthread.h>
+#include <unistd.h>
-#include <libwebsockets.h>
+#include <ico_uws.h>
#include "home_screen.h"
#include "home_screen_res.h"
#define ICO_HSCMD_WS_ADDRESS "127.0.0.1"
#define ICO_HSCMD_WS_PROTOCOL_NAME ICO_HS_PROTOCOL_CM
+//#define hscmd_trace(...)
+#define hscmd_trace(fmt, arg...) fprintf(stderr, ""fmt"\n",##arg)
+
/*============================================================================*/
/* static(internal) functions prototype */
/*============================================================================*/
-static int hscmd_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len);
-static int hscmd_callback_command(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len);
+static void hscmd_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data);
+
static void hscmd_create_ws_context(void);
static void hscmd_destroy_ws_context(void);
static void hscmd_ws_service_loop(void);
/*============================================================================*/
static int hscmd_ws_port = ICO_HS_WS_PORT;
static int hscmd_ws_connected = 0;
-static struct libwebsocket_context *hscmd_ws_context;
-static struct libwebsocket *hscmd_wsi_mirror;
+static struct ico_uws_context *hscmd_uws_context = NULL;
+static void *hscmd_uws_id = NULL;
static FILE *hscmd_fp;
-
-static struct libwebsocket_protocols ws_protocols[] = {
- {
- "http-only",
- hscmd_callback_http,
- 0
- },
- {
- "gui-protocol",
- hscmd_callback_command,
- 0,
- },
- {
- /* end of list */
- NULL,
- NULL,
- 0
- }
-};
+static int hscnd_send_end = 0;
/*============================================================================*/
/* functions */
/*============================================================================*/
-static int
-hscmd_callback_http(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- return 0;
-}
-
/*--------------------------------------------------------------------------*/
/*
- * @brief hscmd_callback_command
- * Connection status is notified from libwebsockets.
- *
- * @param[in] context libwebsockets context
- * @param[in] wsi libwebsockets management table
- * @param[in] reason event type
- * @param[in] user intact
- * @param[in] in receive message
- * @param[in] len message size[BYTE]
- * @return result
- * @retval =0 success
- * @retval =1 error
+ * @brief hscmd_callback_uws
+ * callback function from UWS
+ *
+ * @param[in] context context
+ * @param[in] event event kinds
+ * @param[in] id client id
+ * @param[in] detail event detail
+ * @param[in] data user data
+ * @return none
*/
/*--------------------------------------------------------------------------*/
-static int
-hscmd_callback_command(struct libwebsocket_context *context,
- struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len)
+static void
+hscmd_callback_uws(const struct ico_uws_context *context,
+ const ico_uws_evt_e event, const void *id,
+ const ico_uws_detail *detail, void *data)
{
- long fsize;
- char *sendMsg;
+ unsigned char msg[ICO_HS_TEMP_BUF_SIZE];
+ unsigned char *send;
+ char *in;
+ long fsize;
+ int len;
- switch(reason) {
- case LWS_CALLBACK_CLIENT_ESTABLISHED:
+ hscmd_trace("hscmd_callback_uws %p", context);
+
+ switch (event) {
+ case ICO_UWS_EVT_OPEN:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_OPEN(id=%d)", (int)id);
+ hscmd_uws_id = (void *)id;
+ len = sprintf((char *)msg, "%s %s", ICO_HS_MSG_HEAD_CM, HS_REQ_ANS_HELLO);
+ ico_uws_send((struct ico_uws_context *)context, (void *)id, msg, len);
break;
- case LWS_CALLBACK_CLIENT_RECEIVE:
+
+ case ICO_UWS_EVT_CLOSE:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_CLOSE(id=%d)", (int)id);
+ hscmd_uws_context = NULL;
+ hscmd_uws_id = NULL;
+ break;
+
+ case ICO_UWS_EVT_RECEIVE:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_RECEIVE(id=%d, msg=%s, len=%d)",
+ (int)id, (char *)detail->_ico_uws_message.recv_data,
+ detail->_ico_uws_message.recv_len);
+ in = (char *)detail->_ico_uws_message.recv_data;
+
if(strncmp("ANS HELLO", in, 9) == 0) {
fseek(hscmd_fp, 0, SEEK_END);
fsize = ftell(hscmd_fp);
fseek(hscmd_fp, 0L, SEEK_SET);
- sendMsg = (void *)malloc((int)fsize);
+ len = (int)fsize + 4;
+ send = (void *)malloc(len);
- memset(sendMsg, 0, fsize);
+ memset(send, 0, len);
- fread(sendMsg, 1, fsize, hscmd_fp);
- libwebsocket_write( wsi, (unsigned char *)sendMsg, fsize, LWS_WRITE_BINARY);
- hscmd_destroy_ws_context();
+ sprintf((char *)send, "%s ", ICO_HS_MSG_HEAD_CM);
+
+ fread(send + 4, 1, fsize, hscmd_fp);
+ hscmd_trace("hscmd_callback_uws: send (%s)", send);
+
+ ico_uws_send((struct ico_uws_context *)context, (void *)id, send, len);
+
+ hscnd_send_end = 1;
}
break;
- case LWS_CALLBACK_CLOSED:
- hscmd_wsi_mirror = NULL;
+
+ case ICO_UWS_EVT_ERROR:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_ERROR(id=%d, err=%d)",
+ (int)id, detail->_ico_uws_error.code);
+ break;
+
+ case ICO_UWS_EVT_ADD_FD:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_ADD_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
+ break;
+
+ case ICO_UWS_EVT_DEL_FD:
+ hscmd_trace("hscmd_callback_uws: ICO_UWS_EVT_DEL_FD(id=%d, fd=%d)",
+ (int)id, detail->_ico_uws_fd.fd);
break;
+
default:
break;
}
- return 0;
+ return;
}
/*--------------------------------------------------------------------------*/
static void
hscmd_create_ws_context(void)
{
- hscmd_ws_context
- = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL, ws_protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
+ int ret;
+ char uri[ICO_HS_TEMP_BUF_SIZE];
+
+ /* set up URI "ws://HOST:PORT" */
+ sprintf(uri, "ws://%s:%d", ICO_HS_WS_HOST, hscmd_ws_port);
+
+ hscmd_uws_context = ico_uws_create_context(uri, ICO_HS_PROTOCOL);
hscmd_ws_connected = 0;
- if (hscmd_ws_context == NULL) {
+ if (hscmd_uws_context == NULL) {
fprintf(stderr, "libwebsocket_create_context failed.\n");
} else {
- hscmd_wsi_mirror
- = libwebsocket_client_connect(
- hscmd_ws_context, ICO_HSCMD_WS_ADDRESS, hscmd_ws_port,
- 0, "/", ICO_HSCMD_WS_ADDRESS, NULL,
- ICO_HSCMD_WS_PROTOCOL_NAME, -1);
- if(hscmd_wsi_mirror != NULL) {
- hscmd_ws_connected = 1;
+ /* set callback */
+ ret = ico_uws_set_event_cb(hscmd_uws_context, hscmd_callback_uws, NULL);
+ if (ret != ICO_UWS_ERR_NONE) {
+ hscmd_trace("hscmd_create_ws_context: cannnot set callback");
}
+ hscmd_ws_connected = 1;
}
}
static void
hscmd_destroy_ws_context(void)
{
- if (hscmd_ws_context) {
- libwebsocket_context_destroy(hscmd_ws_context);
- hscmd_ws_context = NULL;
+ if (hscmd_uws_context) {
+ ico_uws_service(hscmd_uws_context);
+ usleep(50 * 1000);
+ ico_uws_unset_event_cb(hscmd_uws_context);
+ ico_uws_close(hscmd_uws_context);
+ hscmd_uws_context = NULL;
hscmd_ws_connected = 0;
}
}
hscmd_ws_service_loop(void)
{
while (hscmd_ws_connected) {
- libwebsocket_service(hscmd_ws_context, 100);
+ ico_uws_service(hscmd_uws_context);
+ usleep(50 * 1000);
+ if (hscnd_send_end == 1) {
+ hscmd_destroy_ws_context();
+ }
}
}
* @date Apr-09-2013
*/
-#define MSG_INTERFACE 0 /* 1= Message Queue Interface */
-#define LWS_INTERFACE 1 /* 1= WebSockets Interface */
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/msg.h>
#include <sys/time.h>
#include <sys/types.h>
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
-#include <libwebsockets.h>
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
+#include <ico_uws.h>
#define TYPE_NULL 0
#define TYPE_BOOL 1
#define TYPE_STRING 8
#define TYPE_SHIFT 12
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
-#define LWS_DEFAULTIP "127.0.0.1" /* websockets default ip(localhost) */
-#define LWS_DEFAULTPORT 25010 /* websockets default port */
+#define LWS_DEFAULTIP "127.0.0.1" /* connection default ip(localhost) */
+#define LWS_DEFAULTPORT 25010 /* connection default port */
#define LWS_PROTOCOLNAME "standarddatamessage-only"
- /* websockets protocol name */
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
-
+ /* connection protocol name */
static const struct {
char *prop;
char *eventtype;
struct KeyDataMsg_t
{
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- long mtype;
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
char KeyEventType[64];
struct timeval recordtime;
struct KeyData
} data;
};
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
-static int sndqueuekey = 55555;
-static int sndqueueid = 0;
-
-static int mqid = -1;
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
-static struct libwebsocket_context *context = NULL;
- /* websockets context */
-static struct libwebsocket *websocket = NULL;
- /* websockets connection */
+static struct ico_uws_context *context = NULL;
+ /* connection context */
+static void *connect_id = NULL;
+ /* connection connection id */
static int connected = 0; /* connection flag */
-static int lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason,
- void *user, void *in, size_t len);
-
-static struct libwebsocket_protocols protocols[] = {
- {LWS_PROTOCOLNAME, lws_callback, 0},
- {NULL, NULL, -1}
- };
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
+static void uws_callback(const struct ico_uws_context *context,
+ const ico_uws_evt_e reason, const void *id,
+ const ico_uws_detail *detail, void *user_data);
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
static void
-init_comm(const int mqkey)
+uws_callback(const struct ico_uws_context *context, const ico_uws_evt_e reason,
+ const void *id, const ico_uws_detail *detail, void *user_data)
{
- char dummy[256];
-
- if (mqkey == 0) {
- mqid = -1;
- }
- else {
- mqid = msgget(mqkey, 0);
- if (mqid < 0) {
- mqid = msgget(mqkey, IPC_CREAT);
- }
- if (mqid < 0) {
- fprintf(stderr, "Can not create message queue(%d(0x%x))[%d]\n",
- mqkey, mqkey, errno);
- return;
- }
- while (msgrcv(mqid, dummy, sizeof(dummy)-sizeof(long), 0, IPC_NOWAIT) > 0) ;
- }
-}
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
-static int
-lws_callback(struct libwebsocket_context *context, struct libwebsocket *wsi,
- enum libwebsocket_callback_reasons reason, void *user,
- void *in, size_t len)
-{
- if (reason == LWS_CALLBACK_CLIENT_ESTABLISHED) {
+ if (reason == ICO_UWS_EVT_OPEN) {
+ connect_id = (void *)id;
connected = 1;
}
+ else if (reason == ICO_UWS_EVT_ERROR) {
+ fprintf(stderr, "Communication Error[%d]\n", detail->_ico_uws_error.code);
+ }
/* do nothing */
- return 0;
}
static void
init_comm(const int port, const char *spadr)
{
int rep;
+ char uri_name[128];
- context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN,
- spadr, protocols,
- libwebsocket_internal_extensions,
- NULL, NULL, -1, -1, 0);
+ snprintf(uri_name, sizeof(uri_name), "ws://%s:%d", spadr, port);
+ connected = 0;
+ context = ico_uws_create_context(uri_name, LWS_PROTOCOLNAME);
if (context == NULL) {
- fprintf(stderr, "Can not create libwebsockets context(ip=%s port=%d)\n",
- spadr, port);
+ fprintf(stderr, "Can not create conextion context(uri=%s port=%d)\n",
+ uri_name, port);
exit(2);
}
+ ico_uws_set_event_cb(context, uws_callback, NULL);
- connected = 0;
- websocket = libwebsocket_client_connect(context, spadr, port,
- 0, "/", spadr, "websocket",
- protocols[0].name, -1);
- if (websocket == NULL) {
- fprintf(stderr, "Can not connect libwebsockets context(ip=%s port=%d)\n",
- spadr, port);
- exit(2);
- }
/* wait for connection */
for (rep = 0; rep < (2*1000); rep += 50) {
if (connected) break;
- libwebsocket_service(context, 50);
+ ico_uws_service(context);
}
}
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
-
-static void
-init_vehicleinfo(void)
-{
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- sndqueueid = msgget(sndqueuekey, 0);
- if (sndqueueid < 0) {
- fprintf(stderr, "Send Message Queue(%d(0x%x)) dose not exist[%d].\n",
- sndqueuekey, sndqueuekey, errno);
- }
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-}
static void
set_vehicleinfo(const char *cmd)
int i, j;
int idx, key, pt;
int msgsize;
+ short *sp;
+ int *ip;
+ double *dp;
char prop[64];
char value[128];
int sec, msec;
struct KeyDataMsg_t msg;
char dummy[128];
} msg;
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
- unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
- unsigned char *bufpt = &buf[LWS_SEND_BUFFER_PRE_PADDING];
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
j = 0;
for (i = 0; cmd[i]; i++) {
}
memset(&msg, 0, sizeof(msg));
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- msg.msg.mtype = 1;
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
strcpy(msg.msg.KeyEventType, vehicleinfo_key[key].eventtype);
gettimeofday(&(msg.msg.recordtime), NULL);
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- msgsize = sizeof(msg) - 128 - sizeof(long);
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
msgsize = sizeof(msg) - 128;
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
i = 0;
pt = 0;
break;
case TYPE_INT16:
case TYPE_UINT16:
- *((short *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0);
+ sp = (short *)&msg.msg.data.status[pt];
+ *sp = strtol(&value[i], (char **)0, 0);
pt += sizeof(short);
msgsize += sizeof(short);
break;
case TYPE_INT32:
case TYPE_UINT32:
- *((int *)&msg.msg.data.status[pt]) = strtol(&value[i], (char **)0, 0);
+ ip = (int *)&msg.msg.data.status[pt];
+ *ip = strtol(&value[i], (char **)0, 0);
pt += sizeof(int);
msgsize += sizeof(int);
break;
case TYPE_DOUBLE:
- *((double *)&msg.msg.data.status[pt]) = strtod(&value[i], (char **)0);
+ dp = (double *)&msg.msg.data.status[pt];
+ *dp = strtod(&value[i], (char **)0);
pt += sizeof(double);
msgsize += sizeof(double);
break;
}
}
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- if (msgsnd(sndqueueid, &msg, msgsize, 0) < 0) {
- fprintf(stderr, "Message Queue(%d(0x%x)) send error[%d].\n",
- sndqueuekey, sndqueuekey, errno);
- }
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
- memcpy(bufpt, &msg, msgsize);
- if (libwebsocket_write(websocket, bufpt, msgsize, LWS_WRITE_BINARY) < 0) {
- fprintf(stderr, "libwebsockets send error\n"); fflush(stderr);
- }
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
+ ico_uws_send(context, connect_id, (unsigned char *)&msg, msgsize);
}
static void
usage(const char *prog)
{
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
fprintf(stderr, "Usage: %s [-port=port] [-ip=ip_addr] [propaty=value] [propaty=value] ...\n", prog);
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- fprintf(stderr, "Usage: %s [-ambkey=key] [-mq[=key]] [propaty=value] [propaty=value] ...\n", prog);
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
exit(0);
}
main(int argc, char *argv[])
{
int i, j;
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
int port = LWS_DEFAULTPORT;
char spadr[64];
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- int mqkey = 0;
- struct {
- long mtype;
- char buf[240];
- } mqbuf;
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
char buf[240];
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
strcpy(spadr, LWS_DEFAULTIP);
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
j = 0;
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- if (strncasecmp(argv[i], "-ambkey=", 8) == 0) {
- sndqueuekey = strtoul(&argv[i][8], (char **)0, 0);
- }
- else if (strncasecmp(argv[i], "-mq", 3) == 0) {
- if (argv[i][3] == '=') {
- mqkey = strtol(&argv[i][4], (char **)0, 0);
- }
- else {
- mqkey = 55552; /* default message queue key */
- }
- }
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
if (strncasecmp(argv[i], "-port=", 6) == 0) {
port = strtoul(&argv[i][6], (char **)0, 0);
}
memset(spadr, 0, sizeof(spadr));
strncpy(spadr, &argv[i][4], sizeof(spadr)-1);
}
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
else {
usage(argv[0]);
}
}
}
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- init_comm(mqkey);
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
init_comm(port, spadr);
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
-
- init_vehicleinfo();
-#if MSG_INTERFACE > 0 /* Message Queue Interface */
- if (mqid >= 0) {
- while (1) {
- memset(&mqbuf, 0, sizeof(mqbuf));
- if (msgrcv(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0, 0) < 0) break;
- k = 0;
- j = -1;
- for (i = 0; mqbuf.buf[i]; i++) {
- if ((mqbuf.buf[i] == '#') || (mqbuf.buf[i] == '\n')
- || (mqbuf.buf[i] == '\r')) break;
- if (mqbuf.buf[i] == '\t') buf[k++] = ' ';
- else buf[k++] = mqbuf.buf[i];
- if ((j < 0) && (mqbuf.buf[i] != ' ')) j = i;
- }
- if (j < 0) continue;
- buf[k] = 0;
- set_vehicleinfo(&buf[j]);
- }
- msgctl(mqid, IPC_RMID, NULL);
- }
- else
-#endif /*MSG_INTERFACE*/ /* Message Queue Interface */
if (j <= 0) {
while (fgets(buf, sizeof(buf), stdin)) {
j = -1;
set_vehicleinfo(argv[i]);
}
}
-#if LWS_INTERFACE > 0 /* WebSocket Interface */
if (context) {
- libwebsocket_context_destroy(context);
+ ico_uws_unset_event_cb(context);
+ ico_uws_close(context);
}
-#endif /*LWS_INTERFACE*/ /* WebSocket Interface */
exit(0);
}
#!/bin/sh
-# 1. kill pulseaudio and weston, and start pulseaudio
-/usr/bin/killall pulseaudio > /dev/null 2>&1
-/usr/bin/killall weston > /dev/null 2>&1
-/bin/sleep 0.2
-/usr/bin/killall -9 pulseaudio > /dev/null 2>&1
-/usr/bin/killall -9 weston > /dev/null 2>&1
-
-# 2. Delete log file
+# 1. Delete log file
/bin/mkdir /var/log/ico > /dev/null 2>&1
/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /opt/bs/core/* > /dev/null 2>&1
+/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-# 3. Weston/Wayland Envionment
-export XDG_RUNTIME_DIR=/tmp/run-root
+# 2. Weston/Wayland Envionment
export QT_QPA_PLATFORM=wayland
export ELM_ENGINE=wayland_egl
export ECORE_EVAS_ENGINE=wayland_egl
-#export ELM_ENGINE=wayland_shm
-#export ECORE_EVAS_ENGINE=wayland_shm
-export EVAS_FONT_DPI=72
-export ECORE_IMF_MODULE=isf
-export ELM_MODULES="ctxpopup_copypasteUI>entry/api:datetime_input_ctxpopup>datetime/api"
-export ELM_SCALE="0.7"
-export ELM_PROFILE=mobile
+export XDG_CONFIG_HOME=/etc/xdg/weston
-# 4. Start Device Input Controller for eGalax TouchPanel
+# 3. Start Device Input Controller for eGalax TouchPanel
#/usr/bin/ico_ictl-touch_egalax -t
/usr/bin/ico_ictl-touch_egalax
sleep 0.3
-# 5. Start Weston
+# 4. Start Weston
ORG_UMASK=`umask`
umask 000
-/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/weston.log &
+/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/ico/weston.log &
sync;sync
sleep 0.8
if [ -f $XDG_RUNTIME_DIR/wayland-0 ] ; then
fi
umask $ORG_UMASK
+# 5 start some daemons
## if pulseaudio dose not start ... kick pulseaudio
/bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
if [ "$?" = "1" ] ; then
sleep 0.5
fi
-# 5 start sample wayland client for display cursor
-#sync;sync
-#/usr/bin/nice -19 /usr/bin/wayland-smoke &
-#sleep 0.3
-
-# 6 start app core daemon
+## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
if [ "$?" = "1" ] ; then
/usr/bin/launchpad_preloading_preinitializing_daemon &
sleep 1
fi
-# 7 start homescreen
-/usr/bin/launch_app org.tizen.ico.homescreen &
+# 6 start homescreen
+export PKG_NAME="org.tizen.ico.homescreen"
+/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen &
--- /dev/null
+#!/bin/sh
+
+# 1. Weston/Wayland Envionment
+export QT_QPA_PLATFORM=wayland
+export ELM_ENGINE=wayland_egl
+export ECORE_EVAS_ENGINE=wayland_egl
+export XDG_CONFIG_HOME=/etc/xdg/weston
+
+# 2. Start Device Input Controller for eGalax TouchPanel
+#/usr/bin/ico_ictl-touch_egalax -t
+/usr/bin/ico_ictl-touch_egalax
+sleep 0.3
+
+# 3 start some daemons
+## if pulseaudio dose not start ... kick pulseaudio
+/bin/ps ax | /bin/grep pulseaudio | /bin/grep -v grep > /dev/null
+if [ "$?" = "1" ] ; then
+ /usr/bin/pulseaudio --log-level=3 --log-target=file:/var/log/ico/pulse.log --system -D
+ sleep 0.5
+fi
+
+## if appcore launcher dose not start ... kick launchpad_preloading_preinitializing_daemon
+/bin/ps ax | /bin/grep launchpad_preloading_preinitializing_daemon | /bin/grep -v grep > /dev/null
+if [ "$?" = "1" ] ; then
+ /usr/bin/launchpad_preloading_preinitializing_daemon &
+ sleep 1
+fi
+
+# 4 start homescreen
+/usr/bin/launch_app org.tizen.ico.homescreen &
+
--- /dev/null
+#!/bin/sh
+
+# 1. Delete log file
+/bin/mkdir /var/log/ico > /dev/null 2>&1
+/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
+/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
+/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
+
+# 2. Weston/Wayland Envionment
+export QT_QPA_PLATFORM=wayland
+export ELM_ENGINE=wayland_egl
+export ECORE_EVAS_ENGINE=wayland_egl
+export XDG_CONFIG_HOME=/etc/xdg/weston
+
+# 3. Start Weston
+ORG_UMASK=`umask`
+umask 000
+/usr/bin/weston --backend=drm-backend.so --idle-time=0 --log=/var/log/weston.log &
+sync;sync
+sleep 0.8
+if [ -f $XDG_RUNTIME_DIR/wayland-0 ] ; then
+ chmod 0777 $XDG_RUNTIME_DIR/wayland-0
+fi
+umask $ORG_UMASK
+
--- /dev/null
+#!/bin/sh
+
+#library(libico-app-fw)
+rm -fr /usr/lib/libico-app-fw-efl.*
+cp ico-app-framework/.libs/libico-app-fw-efl.so.0.0.5 /usr/lib
+ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so.0
+ln -s /usr/lib/libico-app-fw-efl.so.0.0.5 /usr/lib/libico-app-fw-efl.so
+chmod 0755 /usr/lib/libico-app-fw-efl.so.0.0.5
+rm -fr /usr/lib/libico-app-fw.*
+cp ico-app-framework/.libs/libico-app-fw.so.0.0.5 /usr/lib
+ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so.0
+ln -s /usr/lib/libico-app-fw.so.0.0.5 /usr/lib/libico-app-fw.so
+chmod 0755 /usr/lib/libico-app-fw.so.0.0.5
+
+#test tools
+rm -fr /usr/bin/ico_send_hscommand
+rm -fr /usr/bin/ico_send_inputevent
+rm -fr /usr/bin/ico_set_vehicleinfo
+cp test/ico_send_hscommand /usr/bin
+cp test/ico_send_inputevent /usr/bin
+cp test/ico_set_vehicleinfo /usr/bin
+chmod 0755 /usr/bin/ico_send_hscommand /usr/bin/ico_send_inputevent /usr/bin/ico_set_vehicleinfo
+
+#HomeScreen
+HOMESCREEN=org.tizen.ico.homescreen
+cp src/HomeScreen /usr/apps/$HOMESCREEN/bin/
+
+#StatusBar
+PKGNAME=org.tizen.ico.statusbar
+cp src/StatusBar /usr/apps/$PKGNAME/bin/
+
+#OnScreen
+PKGNAME=org.tizen.ico.onscreen
+cp src/OnScreen /usr/apps/$PKGNAME/bin/
+