separate_arguments(EXTERNAL_STATIC_LIB)
separate_arguments(EXTERNAL_SHARED_LIB)
-set(IOTJS_INCLUDE_DIRS
- ${EXTERNAL_INCLUDE_DIR}
- ${ROOT_DIR}/include
- ${IOTJS_SOURCE_DIR}
- ${JERRY_PORT_DIR}/include
- ${JERRY_INCLUDE_DIR}
- ${HTTPPARSER_INCLUDE_DIR}
- ${TUV_INCLUDE_DIR}
+#For TIZEN
+if("${TARGET_OS}" STREQUAL "TIZEN")
+ message (STATUS "-- INCLUDE MODULE FOR TIZEN -- ")
+ INCLUDE(FindPkgConfig)
+ SET(dependents "dlog appcore-agent capi-appfw-service-application capi-appfw-app-common")
+ pkg_check_modules(fw_name REQUIRED ${dependents})
+
+ FOREACH(flag ${fw_name_CFLAGS})
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
+ ENDFOREACH(flag)
+
+ set(IOTJS_INCLUDE_DIRS
+ ${EXTERNAL_INCLUDE_DIR}
+ ${ROOT_DIR}/include
+ ${IOTJS_SOURCE_DIR}
+ ${JERRY_PORT_DIR}/include
+ ${JERRY_INCLUDE_DIR}
+ ${HTTPPARSER_INCLUDE_DIR}
+ ${TUV_INCLUDE_DIR}
+ ${fw_name_CFLAGS}
+ )
+else()
+ set(IOTJS_INCLUDE_DIRS
+ ${EXTERNAL_INCLUDE_DIR}
+ ${ROOT_DIR}/include
+ ${IOTJS_SOURCE_DIR}
+ ${JERRY_PORT_DIR}/include
+ ${JERRY_INCLUDE_DIR}
+ ${HTTPPARSER_INCLUDE_DIR}
+ ${TUV_INCLUDE_DIR}
)
+endif()
set(IOTJS_CFLAGS ${IOTJS_CFLAGS} ${CFLAGS_COMMON})
libhttp-parser
${EXTERNAL_STATIC_LIB}
${EXTERNAL_SHARED_LIB}
+ ${fw_name_LDFLAGS}
)
if(NOT BUILD_LIB_ONLY)
cp %{SOURCE1001} .
%build
-./tools/build.py --clean --buildtype=debug --target-arch=arm --target-os=tizen --target-board=artik10 --no-init-submodule --no-parallel-build --no-check-test
-
+./tools/build.py --clean --buildtype=debug --target-arch=arm --target-os=tizen --target-board=artik10 \
+ --no-init-submodule --no-parallel-build --no-check-test \
+ --external-shared-lib=appcore-agent --iotjs-include-module=tizenappfw
%install
#rm -rf %{buildroot}
#define IOTJS_MAGIC_STRING_WRITESYNC "writeSync"
#define IOTJS_MAGIC_STRING_WRITEUINT8 "writeUInt8"
#define IOTJS_MAGIC_STRING_WRITE "write"
-
+#define IOTJS_MAGIC_STRING_TIZENAPPSTATE "appOn"
+#define IOTJS_MAGIC_STRING_TIZENAPPSTART "appStart"
#endif /* IOTJS_STRING_CONSTANTS_H */
E(F, TCP, Tcp, tcp) \
E(F, TIMER, Timer, timer) \
E(F, UART, Uart, uart) \
- E(F, UDP, Udp, udp)
+ E(F, UDP, Udp, udp) \
+ E(F, TIZENAPPFW, Tizenappfw, tizenappfw)
#define ENUMDEF_MODULE_LIST(upper, Camel, lower) MODULE_##upper,
--- /dev/null
+/* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var util = require('util');
+var tizenappfwBuiltin = process.binding(process.binding.tizenappfw);
+
+
+function Tizenappfw() {
+}
+
+
+Tizenappfw.prototype.start = function() {
+ tizenappfwBuiltin.appStart(util.format.apply(this, arguments) + '\n');
+};
+
+
+Tizenappfw.prototype.on = function() {
+ tizenappfwBuiltin.appOn(util.format.apply(this, arguments) + '\n');
+};
+
+
+module.exports = new Tizenappfw();
+module.exports.Tizenappfw = Tizenappfw;
--- /dev/null
+/* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "iotjs_def.h"
+#include "iotjs_module_tizenappfw.h"
+//#include <service_app.h>
+
+
+static void AppStateOn(iotjs_jhandler_t* jhandler, FILE* out_fd) {
+ JHANDLER_CHECK_ARGS(2, string, function);
+ iotjs_string_t msg = JHANDLER_GET_ARG(0, string);
+ fprintf(out_fd, "%s", iotjs_string_data(&msg));
+ iotjs_string_destroy(&msg);
+
+ const iotjs_jval_t* jcallback1 = JHANDLER_GET_ARG(1, function);
+ int result = (jcallback1 == NULL)?1:0;
+ DLOG("result %d", result);
+}
+
+
+static void AppStart(iotjs_jhandler_t* jhandler, FILE* out_fd) {
+ JHANDLER_CHECK_ARGS(1, string);
+
+ iotjs_string_t msg = JHANDLER_GET_ARG(0, string);
+ fprintf(out_fd, "%s", iotjs_string_data(&msg));
+ iotjs_string_destroy(&msg);
+}
+
+
+JHANDLER_FUNCTION(On) {
+ AppStateOn(jhandler, stdout);
+}
+
+JHANDLER_FUNCTION(Start) {
+ AppStart(jhandler, stdout);
+}
+
+
+iotjs_jval_t InitTizenappfw() {
+ iotjs_jval_t tizenappfw = iotjs_jval_create_object();
+
+ iotjs_jval_set_method(&tizenappfw, IOTJS_MAGIC_STRING_TIZENAPPSTATE, On);
+ iotjs_jval_set_method(&tizenappfw, IOTJS_MAGIC_STRING_TIZENAPPSTART, Start);
+
+ return tizenappfw;
+}
--- /dev/null
+
+
+#ifndef IOTJS_MODULE_TIZENAPPFW_H
+#define IOTJS_MODULE_TIZENAPPFW_H
+
+
+
+#endif /* IOTJS_MODULE_TIZENAPPFW_H */