--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.so.debug.427361990">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.so.debug.427361990" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="so" artifactName="fmwupapi" buildArtefactType="org.tizen.nativecore.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.sharedLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.so.debug.427361990" name="Debug" parent="org.tizen.nativecore.config.sbi.gcc45.so.debug">
+ <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.so.debug.427361990." name="/" resourcePath="">
+ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.so.debug.931936326" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.so.debug">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.652665583" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+ <builder autoBuildTarget="all" buildPath="${workspace_loc:/fmwup_api}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.524524518" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+ <tool command="arm-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.1099346725" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1880495953" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+ <option id="gnu.cpp.compiler.option.optimization.level.2147275429" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1968210624" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+ <option id="sbi.gnu.cpp.compiler.option.363530037" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="iot-headless-4.0-device.core_llvm40.armel"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1009743890" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/attach-panel""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/content""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/csr""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dbus-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/device""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1/eina""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eo-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/feedback""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/fontconfig""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/freetype2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/geofence""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/gio-unix-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/glib-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/harfbuzz""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/iotcon""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/json-glib-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/location""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/maps""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/service-adaptor""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.2143016957" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-mthumb"/>
+ <listOptionValue builtIn="false" value="-fvisibility=hidden"/>
+ </option>
+ <option id="gnu.cpp.compiler.option.include.paths.2023304276" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks.core.220600191" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.preprocessor.def.deprecation.1669566330" name="Defined symbols (-D)" superClass="sbi.gnu.cpp.compiler.option.preprocessor.def.deprecation" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="TIZEN_DEPRECATION"/>
+ <listOptionValue builtIn="false" value="DEPRECATION_WARNING"/>
+ <listOptionValue builtIn="false" value="_DEBUG"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.88951645" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.986162885" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.809669528" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1738938789" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+ <option id="sbi.gnu.c.compiler.option.684694761" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="iot-headless-4.0-device.core_llvm40.armel"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1731436791" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/attach-panel""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/content""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/csr""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dbus-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/device""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1/eina""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eo-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/feedback""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/fontconfig""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/freetype2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/geofence""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/gio-unix-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/glib-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/harfbuzz""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/iotcon""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/json-glib-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/location""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/maps""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/service-adaptor""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.1166472792" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-mthumb"/>
+ <listOptionValue builtIn="false" value="-fvisibility=hidden"/>
+ </option>
+ <option id="gnu.c.compiler.option.include.paths.658214084" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks.core.647623435" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.preprocessor.def.symbols.deprecation.2095717312" name="Defined symbols (-D)" superClass="sbi.gnu.c.compiler.option.preprocessor.def.symbols.deprecation" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="TIZEN_DEPRECATION"/>
+ <listOptionValue builtIn="false" value="DEPRECATION_WARNING"/>
+ <listOptionValue builtIn="false" value="_DEBUG"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2106397814" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.2026146876" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.707833730" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+ <option defaultValue="false" id="sbi.gnu.cpp.link.option.strip.2096767643" name="Omit all symbol information (-s)" superClass="sbi.gnu.cpp.link.option.strip" valueType="boolean"/>
+ <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1763852588" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+ <listOptionValue builtIn="false" value="-lpthread "/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-L"${SBI_SYSROOT}/usr/lib""/>
+ <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+ </option>
+ <option id="gnu.cpp.link.option.paths.2127407685" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1734114204" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool command="#{PLATFORM_DEFAULT_GCC_PREFIX}as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.1711510050" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.470850835" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.1207122477" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.1992048457" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+ <tool id="org.tizen.nativecore.tool.ast.1336829974" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+ <tool id="org.tizen.nativecore.tool.ast.cpp.20906877" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+ <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.284338251" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+ <tool id="org.tizen.nativecore.tool.sbi.po.compiler.419289974" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.538041152" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="org.tizen.nativecore.config.sbi.gcc45.so.release.1108915113">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.tizen.nativecore.config.sbi.gcc45.so.release.1108915113" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.tizen.nativecore.NativeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="so" artifactName="fmwup_api" buildArtefactType="org.tizen.nativecore.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.tizen.nativecore.buildArtefactType.sharedLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;" id="org.tizen.nativecore.config.sbi.gcc45.so.release.1108915113" name="Release" parent="org.tizen.nativecore.config.sbi.gcc45.so.release">
+ <folderInfo id="org.tizen.nativecore.config.sbi.gcc45.so.release.1108915113." name="/" resourcePath="">
+ <toolChain id="org.tizen.nativecore.toolchain.sbi.gcc45.so.release.673724383" name="Tizen Native Toolchain" superClass="org.tizen.nativecore.toolchain.sbi.gcc45.so.release">
+ <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.1624925991" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
+ <builder buildPath="${workspace_loc:/fmwup_api}/Release" id="org.tizen.nativecore.target.sbi.gnu.builder.1326767002" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
+ <tool command="arm-linux-gnueabi-ar" id="org.tizen.nativecore.tool.sbi.gnu.archiver.2060957663" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.1637447993" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+ <option id="gnu.cpp.compiler.option.optimization.level.1200935823" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+ <option defaultValue="gnu.cpp.compiler.debugging.level.none" id="sbi.gnu.cpp.compiler.option.debugging.level.core.647308043" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
+ <option id="sbi.gnu.cpp.compiler.option.2119765831" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="iot-headless-4.0-device.core_llvm40.armel"/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1030826331" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/attach-panel""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/content""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/csr""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dbus-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/device""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1/eina""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eo-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/feedback""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/fontconfig""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/freetype2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/geofence""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/gio-unix-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/glib-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/harfbuzz""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/iotcon""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/json-glib-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/location""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/maps""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/service-adaptor""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.2033886910" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-mthumb"/>
+ <listOptionValue builtIn="false" value="-fvisibility=hidden"/>
+ </option>
+ <option id="gnu.cpp.compiler.option.include.paths.113280859" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="sbi.gnu.cpp.compiler.option.frameworks.core.324855741" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.342932899" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+ </tool>
+ <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1771217314" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.612968583" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option defaultValue="gnu.c.debugging.level.none" id="sbi.gnu.c.compiler.option.debugging.level.core.1176567408" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
+ <option id="sbi.gnu.c.compiler.option.1191186925" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
+ <listOptionValue builtIn="false" value="iot-headless-4.0-device.core_llvm40.armel"/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.759454724" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/attach-panel""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/content""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/csr""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dbus-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/device""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1/eina""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eo-1""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/feedback""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/fontconfig""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/freetype2""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/geofence""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/gio-unix-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/glib-2.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/harfbuzz""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/iotcon""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/json-glib-1.0""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/location""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/maps""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/privacy-privilege-manager/""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/service-adaptor""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks_cflags.core.1810231199" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.c.compiler.option.frameworks_cflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-mthumb"/>
+ <listOptionValue builtIn="false" value="-fvisibility=hidden"/>
+ </option>
+ <option id="gnu.c.compiler.option.include.paths.737170342" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
+ </option>
+ <option id="sbi.gnu.c.compiler.option.frameworks.core.752867410" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" valueType="userObjs">
+ <listOptionValue builtIn="false" value="Native_API"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1056387077" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ </tool>
+ <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.927082769" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
+ <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.2144587492" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+ <option defaultValue="true" id="sbi.gnu.cpp.link.option.strip.696265934" name="Omit all symbol information (-s)" superClass="sbi.gnu.cpp.link.option.strip" valueType="boolean"/>
+ <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.1343560703" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
+ <listOptionValue builtIn="false" value="${TC_LINKER_MISC}"/>
+ <listOptionValue builtIn="false" value="${RS_LINKER_MISC}"/>
+ <listOptionValue builtIn="false" value="-lpthread "/>
+ <listOptionValue builtIn="false" value="--sysroot="${SBI_SYSROOT}""/>
+ <listOptionValue builtIn="false" value="-L"${SBI_SYSROOT}/usr/lib""/>
+ <listOptionValue builtIn="false" value="$(RS_LIBRARIES)"/>
+ </option>
+ <option id="gnu.cpp.link.option.paths.1144300026" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1887230394" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+ <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+ <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+ </inputType>
+ </tool>
+ <tool command="#{PLATFORM_DEFAULT_GCC_PREFIX}as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.399410849" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2117843433" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.188905120" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
+ <tool id="org.tizen.nativecore.tool.fnmapgen.cpp.509884691" name="C++ FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen.cpp"/>
+ <tool id="org.tizen.nativecore.tool.ast.1755301392" name="C Static Analyzer" superClass="org.tizen.nativecore.tool.ast"/>
+ <tool id="org.tizen.nativecore.tool.ast.cpp.1416918814" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
+ <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.1288488113" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
+ <tool id="org.tizen.nativecore.tool.sbi.po.compiler.569374719" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.1548388405" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="res"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="shared"/>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="fmwup_api.org.tizen.nativecore.target.sbi.gcc45.so.186009236" name="Tizen Native Shared Library" projectType="org.tizen.nativecore.target.sbi.gcc45.so"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.so.debug.427361990">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="org.tizen.nativecore.config.sbi.gcc45.so.release.1108915113">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="refreshScope" versionNumber="2">
+ <configuration configurationName="Debug">
+ <resource resourceType="PROJECT" workspacePath="/fmwup_api"/>
+ </configuration>
+ <configuration configurationName="Release">
+ <resource resourceType="PROJECT" workspacePath="/fmwup_api"/>
+ </configuration>
+ </storageModule>
+</cproject>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>fmwup-api</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+ <filteredResources>
+ <filter>
+ <id>0</id>
+ <name></name>
+ <type>26</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-projectRelativePath-matches-false-false-*/.tpk</arguments>
+ </matcher>
+ </filter>
+ <filter>
+ <id>0</id>
+ <name></name>
+ <type>6</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-project_def.prop</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
+</projectDescription>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<tproject xmlns="http://www.tizen.org/tproject">
+ <platforms>
+ <platform>
+ <name>iot-headless-4.0</name>
+ </platform>
+ </platforms>
+ <package>
+ <blacklist/>
+ <resFallback autoGen="true"/>
+ </package>
+</tproject>
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(fmwup-resource)
-SET(VERSION_MAJOR 0)
-SET(VERSION "${VERSION_MAJOR}.1.0")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-
-SET(FMWUP_SRCS
- ${CMAKE_CURRENT_SOURCE_DIR}/src/fmwup_resource.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src/fmwup_resource_internal.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src/fmwup_resource_http.c
-)
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}/inc/
-)
-
-SET(API-HEADERS
- ${CMAKE_CURRENT_LIST_DIR}/inc/fmwup_resource.h
- )
-INSTALL(FILES ${API-HEADERS} DESTINATION include/fmwup-resource)
-
-CONFIGURE_FILE(fmwup-resource.pc.in fmwup-resource.pc @ONLY)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/fmwup-resource.pc DESTINATION ${LIBDIR}/pkgconfig)
-
-ADD_DEFINITIONS(-D_USE_WWST_)
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(fmwup_pkgs REQUIRED
- capi-appfw-application
- capi-system-info
- dlog
- glib-2.0
- iotivity
- libcurl
- vconf
- )
-
-FOREACH(flag ${fmwup_pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-FIND_LIBRARY(RD_LIB NAMES resource_directory PATHS /usr/lib)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${FMWUP_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${fmwup_pkgs_LDFLAGS} ${RD_LIB})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR})
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
-
-ADD_SUBDIRECTORY(test)
+++ /dev/null
-# fmwup library
+++ /dev/null
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
\ No newline at end of file
+++ /dev/null
-prefix=/usr
-libdir=${prefix}/lib
-includedir=${prefix}/include
-
-Name: FMWUP-RESOURCE
-Version: @VERSION@
-Description: OCF-based firmware resource API for OCF SERVER
-Requires: glib-2.0
-Libs: -L${libdir} -lfmwup-resource
-Cflags: -I${includedir} -I${includedir}/fmwup-resource
\ No newline at end of file
--- /dev/null
+#ifndef _FMWUP_API_H_
+#define _FMWUP_API_H_
+
+/**
+ * This header file is included to define _EXPORT_.
+ */
+#include <stdbool.h>
+#include <tizen.h>
+#include "st_things_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @brief Enumeration for XXX.
+ */
+typedef enum {
+ FMWUP_ERROR_NONE = 0, /**< Successful */
+ FMWUP_ERROR_INVALID_PARAMETER = -1, /**< Invalid parameter (If parameter is null or empty)*/
+ FMWUP_ERROR_OPERATION_FAILED = -2, /**< Operation Failed */
+} fmwup_things_error_e;
+
+
+/**
+ * @brief Enumeration for XXX.
+ */
+typedef enum {
+ FMWUP_RESULT_INIT = 0, /**< 0: Initial value. When updating process started (Download /Update), result property MUST set to Initial. */
+ FMWUP_RESULT_SUCCESS, /**< 1: Firmware updated successfully */
+ FMWUP_RESULT_NOT_ENOUGH_MEMORY, /**< 2: Not enough flash memory for the new firmware package. */
+ FMWUP_RESULT_OUT_OF_RAM, /**< 3. Out of RAM during downloading process. */
+ FMWUP_RESULT_CONNECTION_LOST, /**< 4: Connection lost during downloading process. */
+ FMWUP_RESULT_INTEGRITY_FAIL, /**< 5: Integrity check failure for new downloaded package. */
+ FMWUP_RESULT_INVALID_URI, /**< 6: Invalid URI */
+ FMWUP_RESULT_UPDATE_FAILED, /**< 7: Firmware update failed */
+ FMWUP_RESULT_UPDATE_UNSUPPORTED_PROTOCOL /**< 8: Unsupported protocol. */
+} fmwup_result_e;
+
+
+/**
+ * @brief Enumeration for XXX.
+ */
+typedef enum {
+ FMWUP_STATE_IDLE = 0, /**< 0: Idle (before downloading or after successful updating) */
+ FMWUP_STATE_DOWNLOADING, /**< 1: Downloading (The data sequence is on the way) */
+ FMWUP_STATE_DOWNLOADED, /**< 2: Downloaded */
+ FMWUP_STATE_UPDATING /**< 3: Updating */
+} fmwup_state_e;
+
+
+/**
+ * @brief Enumeration for XXX.
+ */
+typedef enum {
+ FMWUP_COMMAND_INIT = 0, /**< 0: Initial value */
+ FMWUP_COMMAND_DOWNLOAD_IMAGE, /**< 1: download image */
+ FMWUP_COMMAND_UPDATE_BY_DOWNLOADED_IMAGE, /**< 2: update using current downloaded image */
+ FMWUP_COMMAND_DOWNLOAD_IMAGE_AND_UPDATE, /**< 3: download and upgrade image */
+ FMWUP_COMMAND_SCHEDULED_UPDATE /**< 4: scheduled update, with updatetime property in firmware resource */
+} fmwup_update_e;
+
+
+typedef void (*fmwup_state_changed_cb)(fmwup_state_e value);
+
+typedef void (*fmwup_is_new_firmware_cb)(bool is_new_firmware);
+
+EXPORT_API int fmwup_handle_get_request(st_things_set_request_message_s *req_msg, st_things_representation_s *resp_rep);
+
+EXPORT_API int fmwup_handle_set_request(st_things_set_request_message_s *req_msg, st_things_representation_s *resp_rep);
+
+EXPORT_API int fmwup_set_firmware_download_path(const char *download_path);
+
+EXPORT_API int fmwup_register_update_changed_cb(fmwup_state_changed_cb state_cb, fmwup_is_new_firmware_cb is_new_firmware_cb );
+
+EXPORT_API int fmwup_get_newest_firmware_from_server(void);
+
+EXPORT_API int fmwup_update(fmwup_update_e command, char *update_time);
+
+EXPORT_API int fmwup_check_firmware_upgraded(void);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _FMWUP_API_H_
+
--- /dev/null
+/*
+ * fmwup_log.h
+ *
+ * Created on: Oct 11, 2017
+ * Author: hhk86heo
+ */
+
+#ifndef FMWUP_LOG_H_
+#define FMWUP_LOG_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ST-THINGS-APP"
+
+#define ERR(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##args)
+#define WARN(fmt, args...) dlog_print(DLOG_WARN, LOG_TAG, fmt"\n", ##args)
+#define INFO(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, fmt"\n", ##args)
+#define DBG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args)
+
+#define FN_CALL dlog_print(DLOG_DEBUG, LOG_TAG, ">>>>>>>> called")
+#define FN_END dlog_print(DLOG_DEBUG, LOG_TAG, "<<<<<<<< ended")
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+#endif /* FMWUP_LOG_H_ */
+++ /dev/null
-#ifndef _FMWUP_H_
-#define _FMWUP_H_
-
-/**
- * This header file is included to define _EXPORT_.
- */
-#include <stdbool.h>
-#include <tizen.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <glib.h>
-#include <octypes.h>
-#if 0
-#include <rd_client.h>
-#endif
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct opq_fmwup_s *fmwup_h;
-
-typedef enum {
- FMWUP_SUCCESS = 0,
- FMWUP_INVALID_VALUE,
- FMWUP_NULL_PTR,
- FMWUP_MEMORY_ERR,
- FMWUP_OPERATION_FAILED,
- FMWUP_ALREADY_EXIST
-}fmwup_result_e;
-
-
-typedef enum {
- /* GET */
- FMWUP_RES_UPDATE_STATE = 0,
- FMWUP_RES_UPDATE_RESULT,
- FMWUP_RES_CURRENT_VERSION,
- FMWUP_RES_NEW_VERSION,
-
- /* SET */
- FMWUP_RES_UPDATE,
- FMWUP_RES_UPDATE_TIME
-}fmwup_res_type_e;
-
-typedef enum {
- FMWUP_STATE_IDLE = 0,
- FMWUP_STATE_DOWNLOADING,
- FMWUP_STATE_DOWNLOADED,
- FMWUP_STATE_UPDATING
-}fmwup_state_e;
-
-
-#if 0
-typedef enum {
- FMWUP_RES_PROP_NONE = 0,
- FMWUP_RES_PROP_DISCOVERABLE = (1<<0),
- FMWUP_RES_PROP_OBSERVABLE = (1<<1),
- FMWUP_RES_PROP_ACTIVE = (1<<2),
- FMWUP_RES_PROP_SLOW = (1<<3),
-#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
- FMWUP_RES_PROP_SECURE = (1 << 4),
-#else
- FMWUP_RES_PROP_SECURE = (0),
-#endif
- FMWUP_RES_PROP_EXPLICIT_DISCOVERABLE = (1 << 5)
-
-#ifdef WITH_MQ
- /** When this bit is set, the resource is allowed to be published */
- ,FMWUP_RES_PROP_MQ_PUBLISHER = (1 << 6)
-#endif
-
-#ifdef MQ_BROKER
- /** When this bit is set, the resource is allowed to be notified as MQ broker.*/
- ,FMWUP_RES_PROP_MQ_BROKER = (1 << 7)
-#endif
-} firmware_res_prop_e;
-#endif
-
-typedef void (*state_changed_cb)(fmwup_state_e value, bool is_new_firmware);
-
-
-EXPORT_API int fmwup_create_firmware_resource(OCResourceHandle *firmware_res_h);
-
-EXPORT_API int fmwup_destory_firmware_resource(OCResourceHandle firmware_res_h);
-
-EXPORT_API int fmwup_set_firmware_download_path(const char *download_path);
-
-EXPORT_API int fmwup_set_state_changed_cb(state_changed_cb callback);
-
-EXPORT_API void fmwup_unset_state_changed_cb(void);
-
-EXPORT_API int fmwup_get_newest_firmware_from_server();
-
-EXPORT_API int fmwup_get_firmware_resource_value(fmwup_res_type_e res_type, char **value);
-
-EXPORT_API int fmwup_set_firmware_resource_value(fmwup_res_type_e res_type, char *value);
-
-EXPORT_API int fmwup_check_firmware_upgraded(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _FMWUP_H_
-
+++ /dev/null
-/*
- * fmwup_internal.h
- *
- * Created on: Jun 29, 2017
- * Author: sangkoo
- */
-
-#ifndef FMWUP_INTERNAL_H_
-#define FMWUP_INTERNAL_H_
-
-
-#include <ocstack.h>
-#include <octypes.h>
-#include <ocpayload.h>
-#include <system_info.h>
-#include <dlog.h>
-#include <vconf.h>
-
-#include "fmwup_resource.h"
-
-#define OC_RSRVD_FIRMWARE_URI "/firmware"
-#ifdef _USE_WWST_
-#define OC_RSRVD_FIRMWARE_RES_TYPE "oic.r.firmware"
-#else
-#define OC_RSRVD_FIRMWARE_RES_TYPE "x.samsung.firmware"
-#endif
-
-#define OC_RSRVD_FIRMWARE_STATE "state"
-#define OC_RSRVD_FIRMWARE_RESULT "result"
-#define OC_RSRVD_FIRMWARE_UPDATE "update"
-#define OC_RSRVD_FIRMWARE_PROGRESS "progress"
-#define OC_RSRVD_FIRMWARE_UPDATE_TIME "updatetime"
-#define OC_RSRVD_FIRMWARE_DESCRIPTION "description"
-
-#define OC_RSRVD_FIRMWARE_CURRENT_VERSION "version"
-#define OC_RSRVD_FIRMWARE_NEW_VERSION "newversion"
-#define OC_RSRVD_FIRMWARE_PACKAGE_URI "packageuri"
-#define OC_RSRVD_FIRMWARE_PACKAGE_SIZE "packagesize"
-#define OC_RSRVD_FIRMWARE_PACKAGE_MD5 "packagemd5"
-
-#define OC_RSRVD_FIRMWARE_VENDER "vender"
-#define OC_RSRVD_FIRMWARE_MODEL "model"
-
-#define OC_RSRVD_FIRMWARE_ACTIVE_CHECK "x.com.samsung.update.activecheck"
-
-
-#define VCONF_FIRMWARE_UPDATE_STATE "db/private/firmware_update/state"
-#define VCONF_FIRMWARE_UPDATE_RESULT "db/private/firmware_update/result"
-
-#define VCONF_FIRMWARE_UPDATE_PACKAGE_NEW_VERSION "db/private/firmware_update/package_new_version"
-#define VCONF_FIRMWARE_UPDATE_PACKAGE_URL "db/private/firmware_update/package_url"
-#define VCONF_FIRMWARE_UPDATE_PACKAGE_SIZE "db/private/firmware_update/package_size"
-#define VCONF_FIRMWARE_UPDATE_PACKAGE_MD5 "db/private/firmware_update/package_md5"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "FIRMWARE_RESOURCE"
-#endif
-
-#define FWR_LOGD(fmt, args...) LOGI(fmt, ##args)
-#define FWR_LOGW(fmt, args...) LOGW(fmt, ##args)
-#define FWR_LOGI(fmt, args...) LOGI(fmt, ##args)
-#define FWR_LOGE(fmt, args...) LOGE(fmt, ##args)
-
-#define FWR_ENTER FWR_LOGD("(%s) ENTER", __FUNCTION__);
-#define FWR_EXIT FWR_LOGD("(%s) EXIT", __FUNCTION__);
-
-typedef struct {
- /* Update Property */
- int state; //[R][M] fmwup_state_e - 0: Idle, 1: Downloading, 2: Downloaded, 3: Updating
- int result; //[R][M] 0: Initial, 1: Success, 2: Not enough space, 3: Out of ram, 4: Connection lost, 5: Invalid binary, 6: Invalid uri, 7: Update failed, 8: Unsupported protocol
- int update; //[RW][M] 0: Initial, 1: Download Image, 2: Upgrade Image, 3:Dwonload and Upgrade, 4 Scheduled Upgrade
- int progress; //[R][O] 0-100 range based progress include downloading state.
- char *update_time; //[RW][O] case of (4 – update) (scheduled) TODO: ISO 8601
- char *description; //[RW][O] Description
-
- /* Package Information */
- char *current_version; //[R][M] Current firmware version
- char *new_version; //[RW][M] New Version of the firmware package
- char *package_uri; //[RW][M] Firmware package URI where the package located
- int64_t package_size; //[RW][O] Package Size
- char *package_md5; //[RW][O] base64-encoded 128-bit MD5 digest of the object
-
- /* Device Information*/
- char *manufacturer; //[R][O] Device vendor identifier
- char *model_name; //[R][O] Device model identifier
-
- /* Vender specific - for polling */
- bool active_check; //[R][O] x.com.samsung.update.activecheck
-
- /* Resource Handle */
- OCResourceHandle *resource_handle;
-} fmwup_s;
-
-typedef enum {
- FMWUP_RESULT_INITIAL = 0,
- FMWUP_RESULT_SUCCESS,
- FMWUP_RESULT_NOT_ENOUGH_SPACE,
- FMWUP_RESULT_OUT_OF_RAM,
- FMWUP_RESULT_CONNECT_LOST,
- FMWUP_RESULT_INVALID_BINARY,
- FMWUP_RESULT_INVALID_URL,
- FMWUP_RESULT_UPDATE_FAILED,
- FMWUP_RESULT_UNSUPPORTED_PROTOCOL,
-}fmwup_result_property_e;
-
-typedef enum {
- FMWUP_EXEC_IDLE = 0,
- FMWUP_EXEC_DOWNLOAD,
- FMWUP_EXEC_UPGRADE,
- FMWUP_EXEC_DOWNLOAD_AND_UPGRADE
-}fmwup_update_property_e;
-
-typedef enum {
- FMWUP_HTTP_GET = 0,
- FMWUP_HTTP_POST,
- FMWUP_HTTP_PUT,
- FMWUP_HTTP_DELETE
-}fmwup_http_req_e;
-
-OCEntityHandlerResult fmwup_handle_firmware_entity(OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest,
- void *callbackParam);
-
-void fmwup_get_firmware_info(fmwup_s *firmware_info);
-
-int fmwup_update_command(int64_t update_type);
-
-void fmwup_propagate_firmware_resource(void);
-
-void fmwup_propagate_firmware_status_resource(fmwup_update_property_e state, fmwup_result_property_e result, bool is_new_firwmare);
-
-int fmwup_http_send_request(fmwup_http_req_e type, char *req_url, char **res_header, char **res_body);
-
-int fmwup_http_download_file(const char *download_url, const char *download_path);
-
-#endif /* FMWUP_INTERNAL_H_ */
--- /dev/null
+/* ****************************************************************
+ *
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef __ST_THINGS_H__
+#define __ST_THINGS_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "st_things_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Initializes things stack and returns whether easy-setup is completed or not.
+ * Easy-setup enable users to acquire the ownership of things and to connect the things with the cloud.
+ * After performing easy-setup, users can access things from anywhere through the cloud.
+ * In things stack, easy-setup is a primary and the first operation to be performed on the thing.
+ * Application running on the thing can know whether easy-setup is done already or not.
+ * If easy-setup is done, app can start the things stack by calling st_things_start().
+ * If easy-setup is not done, app can either wait for the user interaction before starting the things stack or
+ * start the things stack directly without waiting for any events(This case is for those things which doesn't
+ * support input capability and for all other unknown cases).
+ * @param[in] json_path Path to Json file which defines a thing. Definition includes the device information,
+ * resources and their properties, configuration info for connectivity and easy-setup, etc.
+ * @param[out] easysetup_complete Indicates whether easysetup is completed already or not.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_initialize(const char* json_path, bool* easysetup_complete);
+
+/**
+ * @brief Deinitializes things stack.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_deinitialize(void);
+
+/**
+ * @brief Callback for handling GET request.
+ * @param[in] req_msg GET request message.
+ * @param[out] resp_rep Representation that will be set to payload of response.
+ * @return @c true in case of success, otherwise @c false
+ */
+typedef bool (*st_things_get_request_cb) (st_things_get_request_message_s* req_msg,
+ st_things_representation_s* resp_rep);
+
+/**
+ * @brief Callback for handling SET(POST) request.
+ * @param[in] req_msg SET request message.
+ * @param[out] resp_rep Representation that will be set to payload of response.
+ * @return @c true in case of success, otherwise @c false
+ */
+typedef bool (*st_things_set_request_cb) (st_things_set_request_message_s* req_msg,
+ st_things_representation_s* resp_rep);
+
+/**
+ * @brief Callback registration function for handling request messages.
+ * @details The callbacks ensure that a request message will be carried with one of the resource uris from json file of st_things_start().
+ * @remarks Only one callback function can be set with this API.\n
+ * If multiple callbacks are set, the last one is registered only.\n
+ * And the callbacks are called in the internal thread, which is not detached,\n
+ * so application should return it to get the next callbacks.
+ * @param[in] get_cb Reference of the callback function to handle GET request.
+ * @param[in] set_cb Reference of the callback function to handle SET(POST) request.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_register_request_cb(st_things_get_request_cb get_cb,
+ st_things_set_request_cb set_cb);
+
+/**
+ * @brief Starts things stack.
+ * Parses the thing definition(whose path is passed to st_things_initialize(), configures the thing,
+ * creates the resources and prepares it for easy-setup.
+ * If easy-setup is not done yet, onboarding will be started using either SoftAP or BLE connection.
+ * Onboarding creates an ad-hoc network between the thing and the client for performing easy-setup.
+ * If easy-setup is already done, thing will be connected with the cloud.
+ * Application can know whether easy-setup is done or not through st_things_initialize API.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_start(void);
+
+/**
+ * @brief Stops things stack.
+ * Removes all the data being used internally and releases all the memory allocated for the stack.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_stop(void);
+
+/**
+ * @brief Callback for getting user's opinion regarding device reset.
+ * @return @c true to confirm, otherwise @c to deny
+ */
+typedef bool (*st_things_reset_confirm_cb) (void);
+
+/**
+ * @brief Callback for carrying the result of reset.
+ * @param[in] is_success Result of Stack-reset. (true : success, false : failure)
+ */
+typedef void (*st_things_reset_result_cb) (bool is_success);
+
+/**
+ * @brief Callback registration function for Reset-Confirmation and Reset-Result functions.
+ * @remarks Only one callback function can be set with this API.\n
+ * If multiple callbacks are set, the last one is registered only.\n
+ And the callbacks are called in the internal thread, which is not detached,\n
+ * so application should return it to get the next callbacks.
+ * @param[in] confirm_cb Callback function that will be called to get the user's input when reset is triggered.
+ * @param[in] result_cb Callback function that will be called after the reset process is done.
+ * This parameter can be NULL if notification for result of reset is not needed.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_register_reset_cb(st_things_reset_confirm_cb confirm_cb,
+ st_things_reset_result_cb result_cb);
+
+/**
+ * @brief Reset all the data related to security and cloud being used in the stack.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_reset(void);
+
+/**
+ * @brief Callback for carrying the randomly generated PIN info.
+ * @details Device should show the PIN on display.
+ * @param[in] pin_data PIN data in string format.
+ * @param[in] pin_size Length of the PIN String.
+ */
+typedef void (*st_things_pin_generated_cb) (const char* pin_data, const size_t pin_size);
+
+/**
+ * @brief Callback for informing the application to close the PIN display.
+ */
+typedef void (*st_things_pin_display_close_cb) (void);
+
+/**
+ * @brief Callback registration function for getting randomly generated PIN for the PIN-Based Ownership Transfer Request.
+ * @remarks Only one callback function can be set with this API.\n
+ * If multiple callbacks are set, the last one is registered only.\n
+ * And the callbacks are called in the internal thread, which is not detached,\n
+ * so application should return it to get the next callbacks.
+ * @param[in] generated_cb Callback function that will be called when device receives a Ownership Transfer request from client.
+ * @param[in] close_cb Callback function that will be called when Ownership Transfer is done so device can stop showing PIN on display.
+ * This parameter can be NULL if stop triggering is not needed.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_register_pin_handling_cb(st_things_pin_generated_cb generated_cb,
+ st_things_pin_display_close_cb close_cb);
+
+/**
+ * @brief Callback for getting user's input regarding mutual verification.
+ * @return @c true true in cse of confirmed, otherwise @c false
+ */
+typedef bool (*st_things_user_confirm_cb) (void);
+
+/**
+ * @brief Callback registration function for getting user confirmation for MUTUAL VERIFICATION BASED JUST WORK Ownership transfer.
+ * @remarks Only one callback function can be set with this API.\n
+ * If multiple callbacks are set, the last one is registered only.\n
+ * And the callbacks are called in the internal thread, which is not detached,\n
+ * so application should return it to get the next callbacks.
+ * @param[in] confirm_cb Callback function that will be called when device receives a confirm request from client.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_register_user_confirm_cb(st_things_user_confirm_cb confirm_cb);
+
+/**
+ * @brief Callback for getting the current state of ST Things.
+ * @param[in] things_status ST Things State
+ */
+typedef void (*st_things_status_change_cb) (st_things_status_e things_status);
+
+/**
+ * @brief Callback registration function for getting notified when ST Things state changes.
+ * @remarks Only one callback function can be set with this API.\n
+ * If multiple callbacks are set, the last one is registered only.\n
+ * And the callbacks are called in the internal thread, which is not detached,\n
+ * so application should return it to get the next callbacks.
+ * @param[in] status_cb Refernce of the callback function to get ST Things status
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_register_things_status_change_cb(st_things_status_change_cb status_cb);
+
+/**
+ * @brief Notify the observers of a specific resource.
+ * @param[in] resource_uri Resource URI of the resource which will be notified to observers.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_notify_observers(const char* resource_uri);
+
+/**
+ * @brief Send Representation of a specific resource through push service to Samsung Connect client.
+ * @param[in] resource_uri Resource uri for which we want to send push message.
+ * @param[in] rep Representation for resource uri.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #ST_THINGS_ERROR_NONE Successful
+ * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ST_THINGS_ERROR_OPERATION_FAILED Operation failed
+ */
+int st_things_send_push_message(const char* resource_uri, st_things_representation_s* rep);
+
+/**
+ * @brief Create an instance of representation.
+ * @remarks To destroy an instance, st_things_destroy_representation_inst() should be used.
+ * @return a pointer of the created representation, otherwise a null pointer if the memory is insufficient.
+ */
+st_things_representation_s* st_things_create_representation_inst(void);
+
+/**
+ * @brief Destroy an instance of representation.
+ * @param[in] rep Representation that will be destroyed.
+ */
+void st_things_destroy_representation_inst(st_things_representation_s* rep);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ST_THINGS_H__ */
--- /dev/null
+/* ****************************************************************
+ *
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef __ST_THINGS_TYPES_H__
+#define __ST_THINGS_TYPES_H__
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+/**
+ * @brief Enumeration for ST Things error code.
+ */
+typedef enum {
+ ST_THINGS_ERROR_NONE = 0, /**< Successful */
+ ST_THINGS_ERROR_INVALID_PARAMETER = -1, /**< Invalid parameter (If parameter is null or empty)*/
+ ST_THINGS_ERROR_OPERATION_FAILED = -2, /**< Operation Failed */
+} st_things_error_e;
+
+/**
+ * @brief Enumeration for ST Things status.
+ */
+typedef enum {
+ ST_THINGS_STATUS_INIT = 0, /**< Initial state of ST Things */
+ ST_THINGS_STATUS_ES_STARTED, /**< Easy-setup is started */
+ ST_THINGS_STATUS_ES_DONE, /**< Easy-setup is done */
+ ST_THINGS_STATUS_ES_FAILED_ON_OWNERSHIP_TRANSFER, /**< Easy-setup failed due to Ownership-Transfer failure */
+ ST_THINGS_STATUS_CONNECTING_TO_AP, /**< Connecting to target Wi-Fi access point */
+ ST_THINGS_STATUS_CONNECTED_TO_AP, /**< Connected to target Wi-Fi access point */
+ ST_THINGS_STATUS_CONNECTING_TO_AP_FAILED, /**< Failed to connect to target Wi-Fi access point */
+ ST_THINGS_STATUS_REGISTERING_TO_CLOUD, /**< Trying to Sign-up/Sign-in/Publish-Resource(s) to Cloud */
+ ST_THINGS_STATUS_REGISTERED_TO_CLOUD, /**< Publish resource(s) to cloud is complete. Now the Thing is ready to be controlled via Cloud */
+ ST_THINGS_STATUS_REGISTERING_FAILED_ON_SIGN_IN, /**< Failed to sign-in to Cloud */
+ ST_THINGS_STATUS_REGISTERING_FAILED_ON_PUB_RES /**< Failed to publish resources to Cloud */
+} st_things_status_e;
+
+/**
+ * @brief Structure for Representation.
+ */
+typedef struct _st_things_representation
+{
+ void* payload; /**< Payload of representation */
+
+ /**
+ * @brief API for getting the value of string type property with a key.
+ * @remarks This API will return deep-copied string value as out parameter, so application must free it after use.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value String value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_str_value) (struct _st_things_representation* rep, const char* key, char** value);
+
+ /**
+ * @brief API for getting the value of boolean type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value Bool value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_bool_value) (struct _st_things_representation* rep, const char* key, bool* value);
+
+ /**
+ * @brief API for getting the value of integer type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value Integer value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_int_value) (struct _st_things_representation* rep, const char* key, int64_t* value);
+
+ /**
+ * @brief API for getting the value of double type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value Double value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_double_value) (struct _st_things_representation* rep, const char* key, double* value);
+
+ /**
+ * @brief API for getting the value of byte array type property with a key.
+ * @remarks This API will return deep-copied byte value as out parameter, so application must free it after use.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value Byte value
+ * @param[out] size Size of Byte value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_byte_value) (struct _st_things_representation* rep, const char* key, uint8_t** value, size_t* size);
+
+ /**
+ * @brief API for getting the value of object type property with a key.
+ * @remarks This API will return deep-copied object value as out parameter, so application must free it after use.\n
+ * To free an object, st_things_destroy_representation_inst() in st_things.h should be used.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[out] value Object value
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_object_value) (struct _st_things_representation* rep, const char* key, struct _st_things_representation** value);
+
+ /**
+ * @brief API for setting the value of string type property with a key.
+ * @remarks This API will deep-copy the string value inside, so application still has an ownership of memory for the string value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value String value.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_str_value) (struct _st_things_representation* rep, const char* key, const char* value);
+
+ /**
+ * @brief API for setting the value of boolean type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value Bool value.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_bool_value) (struct _st_things_representation* rep, const char* key, bool value);
+
+ /**
+ * @brief API for setting the value of integer type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value Integer value.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_int_value) (struct _st_things_representation* rep, const char* key, int64_t value);
+
+ /**
+ * @brief API for setting the value of double type property with a key.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value Double value.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_double_value) (struct _st_things_representation* rep, const char* key, double value);
+
+ /**
+ * @brief API for setting the value of byte array type property with a key.
+ * @remarks This API will deep-copy the byte value inside, so application still has an ownership of memory for the byte value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value Byte value.
+ * @param[in] size Size of Byte value.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_byte_value) (struct _st_things_representation* rep, const char* key, const uint8_t* value, size_t size);
+
+ /**
+ * @brief API for setting the value of object type property with a key.
+ * @remarks This API will deep-copy the object value inside, so application still has an ownership of memory for the object value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the value.
+ * @param[in] value Object value.
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*set_object_value) (struct _st_things_representation* rep, const char* key, const struct _st_things_representation* value);
+
+ /**
+ * @brief API for getting the value of string array type property with a key.
+ * @remarks This API will return deep-copied array value as out parameter, so application must free it after use.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the array type of value.
+ * @param[out] array Reference of the string array to where the value will be copied.
+ * @param[out] length Total number of elements in the array.
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_str_array_value) (struct _st_things_representation* rep, const char* key, char*** array, size_t* length);
+
+ /**
+ * @brief API for getting the value of integer array type property with a key.
+ * @remarks This API will return deep-copied array value as out parameter, so application must free it after use.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the array type of value.
+ * @param[out] array Reference of the integer array where the value will be copied.
+ * @param[out] length Total number of elements in the array.
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_int_array_value) (struct _st_things_representation* rep, const char* key, int64_t** array, size_t* length);
+
+ /**
+ * @brief API for getting the value of double array type property with a key.
+ * @remarks This API will return deep-copied array value as out parameter, so application must free it after use.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which will represent the array type of value.
+ * @param[out] array Reference of the double array where the value will be copied.
+ * @param[out] length Total number of elements in the array.
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_double_array_value) (struct _st_things_representation* rep, const char* key, double** array, size_t* length);
+
+ /**
+ * @brief API for getting the value of object array type property with a key.
+ * @remarks This API will return deep-copied array value as out parameter, so application must free it after use.\n
+ * To free each object in array, st_things_destroy_representation_inst() in st_things.h should be used.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the array type of value.
+ * @param[out] array Reference of the object array where the value will be copied.
+ * @param[out] length Total number of elements in the array.
+ * @return @c true if value exist, otherwise @c false
+ */
+ bool (*get_object_array_value) (struct _st_things_representation* rep, const char* key, struct _st_things_representation*** array, size_t* length);
+
+ /**
+ * @brief API for setting the value of string array type property with a key.
+ * @remarks This API will deep-copy the array value inside, so application still has an ownership of memory for the array value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[in] array String array type value.
+ * @param[in] length Total number of elements in the array.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_str_array_value) (struct _st_things_representation* rep, const char* key, const char** array, size_t length);
+
+ /**
+ * @brief API for setting the value of integer array type property with a key.
+ * @remarks This API will deep-copy the array value inside, so application still has an ownership of memory for the array value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[in] array Integer array type value.
+ * @param[in] length Total number of elements in the array.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_int_array_value) (struct _st_things_representation* rep, const char* key, const int64_t* array, size_t length);
+
+ /**
+ * @brief API for setting the value of double array type property with a key.
+ * @remarks This API will deep-copy the array value inside, so application still has an ownership of memory for the array value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[in] array Double array type value.
+ * @param[in] length Total number of elements in the array.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_double_array_value) (struct _st_things_representation* rep, const char* key, const double* array, size_t length);
+
+ /**
+ * @brief API for setting the value of object array type property with a key.
+ * @remarks This API will deep-copy the array value inside, so application still has an ownership of memory for the array value.
+ * @param[in] rep Instance of Representation.
+ * @param[in] key Property Name which represents the value.
+ * @param[in] array Object array type value.
+ * @param[in] length Total number of elements in the array.
+ * @return @c true if setting value is successful, otherwise @c false
+ */
+ bool (*set_object_array_value) (struct _st_things_representation* rep, const char* key, const struct _st_things_representation** array, size_t length);
+
+} st_things_representation_s;
+
+/**
+ * @brief Structure for representing the Get Request Message.
+ */
+typedef struct _st_things_get_request_message
+{
+ char* resource_uri; /**< Resource URI */
+ char* query; /**< One or more query parameters of the request message. Ex: key1=value1;key2=value2;... */
+ char* property_key; /**< One or more property key that application needs to set a value for response. Ex: key1;key2;... */
+
+ /**
+ * @brief API for getting the value of a specific query from the query parameters of the request.
+ * @param[in] req_msg Instance of get request message.
+ * @param[in] key Name of the query.(ex: key1, key2, etc)
+ * @param[out] value Value of the query.(value1, value2, etc)
+ * @return @c true if query exist, otherwise @c false
+ */
+ bool (*get_query_value) (struct _st_things_get_request_message* req_msg, const char* key, char** value);
+
+ /**
+ * @brief API for checking whether the request has a specific property key or not.
+ * @param[in] req_msg Instance of get request message.
+ * @param[in] key Name of the property.
+ * @return @c true if the property key exists, otherwise @c false
+ */
+ bool (*has_property_key) (struct _st_things_get_request_message* req_msg, const char* key);
+
+} st_things_get_request_message_s;
+
+/**
+ * @brief Structure for representing the Set Request Message.
+ */
+typedef struct _st_things_set_request_message
+{
+ char* resource_uri; /**< Resource URI */
+ char* query; /**< One or more query parameters of the request message. Ex: key1=value1?key2=value2?... */
+ struct _st_things_representation* rep; /**< Representation of the set request message */
+
+ /**
+ * @brief API for getting the value of a specific query from the query parameters of the request.
+ * @param[in] req_msg Instance of request message.
+ * @param[in] key Name of the query.(ex: key1, key2, etc)
+ * @param[out] value Value of the query.(value1, value2, etc)
+ * @return @c true if query exist, otherwise @c false
+ */
+ bool (*get_query_value) (struct _st_things_set_request_message* req_msg, const char* key, char** value);
+
+} st_things_set_request_message_s;
+
+#endif /* __ST_THINGS_TYPES_H__ */
+++ /dev/null
-Name: fmwup-resource
-Version: 0.0.1
-Release: 1
-License: Apache-2.0
-Summary: OCF-based firmware resource API for controlee
-Group: Network & Connectivity/Libraries
-Source0: %{name}-%{version}.tar.gz
-
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
-BuildRequires: cmake
-BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(iotivity)
-BuildRequires: pkgconfig(key-manager)
-BuildRequires: pkgconfig(libcurl)
-BuildRequires: pkgconfig(vconf)
-
-%description
-Description: Controlee firmware resource API
-
-%package devel
-License: Apache-2.0
-Summary: OCF-based firmware resource API for controlee (development)
-Group: Network & Connectivity/Libraries
-%description devel
-Description: OCF-based firmware resource API for controlee (development)
-
-%package test
-License: Apache-2.0
-Summary: Test app for OCF-based firmware resource API
-Group: Network & Connectivity/Testing
-%description test
-Description: Test program for OCF-based firmware resource API
-
-%prep
-%setup -q
-
-%build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
- -DLIB_INSTALL_DIR=%{_libdir}
-
-make %{?jobs:-j%jobs}
-
-%install
-
-%make_install
-
-%clean
-rm -rf %{buildroot}
-
-%post
-/sbin/ldconfig
-/usr/bin/vconftool set -t int db/private/firmware_update/state 0 -s tizen::vconf::platform::rw
-/usr/bin/vconftool set -t int db/private/firmware_update/result 0 -s tizen::vconf::platform::rw
-/usr/bin/vconftool set -t string db/private/firmware_update/package_new_version "" -s tizen::vconf::platform::rw
-/usr/bin/vconftool set -t string db/private/firmware_update/package_url "" -s tizen::vconf::platform::rw
-/usr/bin/vconftool set -t double db/private/firmware_update/package_size "" -s tizen::vconf::platform::rw
-/usr/bin/vconftool set -t string db/private/firmware_update/package_md5 0 -s tizen::vconf::platform::rw
-mkdir -p /opt/usr/data/ua-client
-
-chsmack -a "_" ./usr/lib/libfmwup-resource.so*
-
-%postun
-/sbin/ldconfig
-
-%files
-%defattr(-,root,root,-)
-%{_libdir}/libfmwup-resource.so*
-
-%files devel
-%{_libdir}/libfmwup-resource.so
-%{_libdir}/pkgconfig/fmwup-resource.pc
-%{_includedir}/fmwup-resource/*
-
-%files test
-%defattr(-,root,root,-)
-%{_bindir}/fmwup_test
-#%config(noreplace) /opt/usr/data/ua-client/thawte.cert.pem
-#%config(noreplace) /opt/usr/data/ua-client/oic_svr_db_client.dat
-
-
--- /dev/null
+APPNAME = fmwup_api
+
+type = sharedLib
+profile = iot-headless-4.0
+
+USER_SRCS = src/fmwup_api.c
+USER_DEFS =
+USER_INC_DIRS = inc
+USER_OBJS =
+USER_LIBS =
+USER_EDCS =
--- /dev/null
+/**
+ * This file contains the exported symbol.
+ */
+#include "fmwup_api.h"
+
+// This is an example of an exported method.
+//bool
+//tizenfmwup_api(void)
+//{
+// return true;
+//}
+++ /dev/null
-#include <fmwup_resource.h>
-#include <fmwup_resource_internal.h>
-
-fmwup_s* g_firmware_resource = NULL;
-state_changed_cb g_state_changed_cb = NULL;
-char *g_download_path = NULL;
-
-
-int fmwup_create_firmware_resource(OCResourceHandle *firmware_res_h)
-{
- if (!firmware_res_h)
- return FMWUP_NULL_PTR;
-
- if (g_firmware_resource)
- return FMWUP_ALREADY_EXIST;
-
- fmwup_s *tmp_firmware_res = NULL;
- OCResourceHandle oc_handle = NULL;
-
- if (OCCreateResource(&oc_handle, OC_RSRVD_FIRMWARE_RES_TYPE,
- OC_RSRVD_INTERFACE_DEFAULT, "/firmware", /* OC_RSRVD_INTERFACE_DEFAULT : "oic.if.baseline" */
- fmwup_handle_firmware_entity, NULL,
- OC_DISCOVERABLE | OC_OBSERVABLE) != OC_STACK_OK) {
- return FMWUP_OPERATION_FAILED;
- }
-
- tmp_firmware_res = (fmwup_s *)calloc(1, sizeof(fmwup_s));
- if (tmp_firmware_res == NULL) return FMWUP_MEMORY_ERR;
-
- fmwup_get_firmware_info(tmp_firmware_res);
-
- tmp_firmware_res->resource_handle = oc_handle;
-
- g_firmware_resource = tmp_firmware_res;
- *firmware_res_h = oc_handle;
-
- return FMWUP_SUCCESS;
-}
-
-
-int fmwup_destory_firmware_resource(OCResourceHandle firmware_res_h)
-{
- if (!firmware_res_h)
- return FMWUP_NULL_PTR;
-
- if (firmware_res_h == g_firmware_resource->resource_handle) {
- if (OCDeleteResource(g_firmware_resource->resource_handle) != OC_STACK_OK) {
- FWR_LOGE("OCDeleteResource() failed for firmware_resource");
- }
-
- g_free(g_firmware_resource->current_version);
- g_free(g_firmware_resource->new_version);
- g_free(g_firmware_resource->package_uri);
- g_free(g_firmware_resource->package_md5);
- g_free(g_firmware_resource->manufacturer);
- g_free(g_firmware_resource->model_name);
- g_free(g_firmware_resource);
-
- g_firmware_resource = NULL;
- } else {
- return FMWUP_INVALID_VALUE;
- }
-
- return FMWUP_SUCCESS;
-}
-
-int fmwup_set_firmware_download_path(const char *download_path)
-{
- if (!download_path)
- return FMWUP_INVALID_VALUE;
-
- g_free(g_download_path);
- g_download_path = NULL;
- g_download_path = g_strdup(download_path);
- FWR_LOGI("g_download_path [%s]", g_download_path);
-
- return FMWUP_SUCCESS;
-}
-
-
-int fmwup_set_state_changed_cb(state_changed_cb callback)
-{
- if (!callback)
- return FMWUP_NULL_PTR;
-
- g_state_changed_cb = callback;
-
- return FMWUP_SUCCESS;
-}
-
-void fmwup_unset_state_changed_cb(void)
-{
- g_state_changed_cb = NULL;
-}
-
-
-int fmwup_get_newest_firmware_from_server()
-{
- if (!g_firmware_resource) {
- FWR_LOGE("g_firmware_resource is NULL");
- return FMWUP_NULL_PTR;
- }
-
- FWR_LOGD("g_firmware_resource active_check [true]");
- g_firmware_resource->active_check = true;
- fmwup_propagate_firmware_resource();
- return FMWUP_SUCCESS;
-}
-
-
-int fmwup_get_firmware_resource_value(fmwup_res_type_e res_type, char **value)
-{
- if (!g_firmware_resource) {
- FWR_LOGE("g_firmware_resource is NULL");
- return FMWUP_NULL_PTR;
- }
-
- int result = FMWUP_SUCCESS;
-
- char buf[2] = {0,};
-
- switch (res_type) {
- case FMWUP_RES_UPDATE_STATE:
- snprintf(buf, sizeof(buf), "%d", g_firmware_resource->state);
- *value = g_strdup(buf);
- break;
- case FMWUP_RES_UPDATE_RESULT:
- snprintf(buf, sizeof(buf), "%d", g_firmware_resource->result);
- *value = g_strdup(buf);
- break;
- case FMWUP_RES_CURRENT_VERSION:
- *value = g_strdup(g_firmware_resource->current_version);
- break;
- case FMWUP_RES_NEW_VERSION:
- *value = g_strdup(g_firmware_resource->new_version);
- break;
- default :
- result = FMWUP_INVALID_VALUE;
- *value = NULL;
- break;
- }
-
- return result;
-}
-
-
-int fmwup_set_firmware_resource_value(fmwup_res_type_e res_type, char *value)
-{
- if (!g_firmware_resource) {
- FWR_LOGE("g_firmware_resource is NULL");
- return FMWUP_NULL_PTR;
- }
-
- if (value == NULL) {
- FWR_LOGE("value is NULL");
- return FMWUP_INVALID_VALUE;
- }
-
- int result = FMWUP_SUCCESS;
-
- switch (res_type) {
- case FMWUP_RES_UPDATE:
- if (value == NULL || (value && strlen(value) != 1)) {
- result = FMWUP_INVALID_VALUE;
- FWR_LOGE("value is invalid");
- break;
- }
- FWR_LOGI("value is [%s]", value);
-
- int64_t update = (int64_t)atoi(value);
- if (fmwup_update_command(update) != 0) {
- result = FMWUP_MEMORY_ERR;
- FWR_LOGE("allocate failed");
- }
- break;
-
- case FMWUP_RES_UPDATE_TIME:
- if (g_strcmp0(value, g_firmware_resource->update_time)) {
- g_free(g_firmware_resource->update_time);
- g_firmware_resource->update_time = g_strdup(value);
- } else {
- result = FMWUP_ALREADY_EXIST;
- FWR_LOGI("Invalid res_type[%d]", res_type);
- }
- break;
-
- default :
- result = FMWUP_INVALID_VALUE;
- FWR_LOGI("Invalid res_type[%d]", res_type);
- break;
- }
-
- return result;
-}
-
-
-int fmwup_check_firmware_upgraded(void)
-{
- if (!g_firmware_resource) {
- FWR_LOGE("g_firmware_resource is NULL");
- return FMWUP_NULL_PTR;
- }
-
- if (g_firmware_resource->state == FMWUP_STATE_UPDATING) {
- FWR_LOGD("***Firmware Upgrade Done***");
-
- /* Initialize - new firmware information - */
- g_free(g_firmware_resource->new_version);
- g_firmware_resource->new_version = g_strdup("");
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_NEW_VERSION, "");
-
- g_free(g_firmware_resource->package_uri);
- g_firmware_resource->package_uri = g_strdup("");
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_URL, "");
-
- g_free(g_firmware_resource->package_md5);
- g_firmware_resource->package_md5 = g_strdup("");
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_MD5, "");
-
- g_firmware_resource->package_size = 0;
- vconf_set_dbl(VCONF_FIRMWARE_UPDATE_PACKAGE_SIZE, (double)0);
-
- // TODO :: It should be checked and set result value according to upgrade result
- fmwup_propagate_firmware_status_resource(FMWUP_STATE_IDLE, FMWUP_RESULT_SUCCESS, false);
-
- } else {
- FWR_LOGE("is not updating, state[%d]", g_firmware_resource->state);
- return FMWUP_OPERATION_FAILED;
- }
-
- return FMWUP_SUCCESS;
-}
+++ /dev/null
-#include <curl/curl.h>
-
-#include <fmwup_resource_internal.h>
-
-static size_t _gather_data(void *downloaded_data,
- size_t size,
- size_t nmemb,
- void *user_data)
-{
- size_t total_size = size * nmemb;
- g_byte_array_append((GByteArray *)user_data, (const unsigned char *) downloaded_data, total_size);
- return total_size;
-}
-
-
-void _curl_set_response(CURL *curl,
- GByteArray *response_header,
- GByteArray *response_body,
- char **res_header,
- char **res_body,
- void *user_data)
-{
- FWR_ENTER
- CURLcode curl_ret_code;
-
- long response = 0;
- curl_ret_code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
- if (CURLE_OK != curl_ret_code) {
- FWR_LOGE("curl_easy_perform(): [%s][%d]", curl_easy_strerror(curl_ret_code), curl_ret_code);
- return;
- }
-
- char *tmp_header = g_strndup((const gchar *)response_header->data, response_header->len);
- char *tmp_body = g_strndup((const gchar *)response_body->data, response_body->len);
-
- *res_header = tmp_header;
- *res_body = tmp_body;
- FWR_EXIT
-}
-
-
-void _curl_set_common_option(CURL *curl,
- const char *url,
- GByteArray **response_header_ptr,
- GByteArray **response_body_ptr)
-{
- //LOG("_curl_set_common_option()");
- CURLcode curl_ret_code;
-
- //LOG("set URL = [%s]", url);
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_URL, url);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_URL failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- GByteArray *response_header_data = g_byte_array_new();
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, _gather_data);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_HEADERFUNCTION failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_HEADERDATA, response_header_data);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_HEADERDATA failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- GByteArray *response_body_data = g_byte_array_new();
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _gather_data);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_WRITEFUNCTION failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_WRITEDATA, response_body_data);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_WRITEDATA failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_NOPROGRESS failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- *response_header_ptr = response_header_data;
- *response_body_ptr = response_body_data;
-
-#if 0
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_VERBOSE failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_SSL_VERIFYPEER failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, FALSE);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_SSL_VERIFYHOST failed!! curl_ret_code[%d]", curl_ret_code);
- }
-
- curl_ret_code = curl_easy_setopt(curl, CURLOPT_CERTINFO, 0L);
- if (CURLE_OK != curl_ret_code) {
- //LOG("curl_easy_setopt: CURLOPT_CERTINFO failed!! curl_ret_code[%d]", curl_ret_code);
- }
-#endif
-}
-
-
-static void _curl_set_request_headers(CURL *curl)
-{
- struct curl_slist *header = NULL;
-
- char *tmp_header = NULL;
-
- tmp_header = g_strconcat("Content-Type: ", "application/json", NULL);
- //LOG("header=[%s]", tmp_header);
- header = curl_slist_append(header, tmp_header);
- g_free(tmp_header);
-
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
-}
-
-
-int fmwup_http_send_request(fmwup_http_req_e type, char *req_url, char **res_header, char **res_body)
-{
- FWR_ENTER
-
- CURL *curl;
- GByteArray *response_header = NULL;
- GByteArray *response_body= NULL;
- CURLcode error_code;
- int ret = 0;
-
- // Start a libcurl easy session
- curl = curl_easy_init();
-
- //LOG("curl_easy_init()");
-
- _curl_set_request_headers(curl);
-
- if (type == FMWUP_HTTP_GET) {
- curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
- } else if (type == FMWUP_HTTP_POST) {
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
- } else {
- return -1;
- }
-
- _curl_set_common_option(curl, (const char *)req_url, &response_header, &response_body);
-
- //LOG("Start curl_easy_perform......");
- error_code = curl_easy_perform(curl);
- FWR_LOGI("curl_easy_perform(): [%s][%d]", curl_easy_strerror(error_code), error_code);
-
- if (error_code == CURLE_ABORTED_BY_CALLBACK) {
- ret = -1;
- goto _END_OF_FUNC_;
- } else if (error_code != CURLE_OK) {
- ret = -1;
- goto _END_OF_FUNC_;
- }
-
- _curl_set_response(curl, response_header, response_body, res_header, res_body, NULL);
-
-_END_OF_FUNC_:
-
- if (response_header) {
- g_byte_array_free(response_header, TRUE);
- }
- if (response_body) {
- g_byte_array_free(response_body, TRUE);
- }
-
- curl_easy_cleanup(curl);
- FWR_EXIT
- return ret;
-}
-
-
-int fmwup_http_download_file(const char *download_url, const char *download_path)
-{
- FWR_ENTER
-
- if (!download_url || !download_path) {
- FWR_LOGE("Invalid parameter");
- return -1;
- }
-
- int ret = 0;
- CURL *curl;
- FILE *fp;
- CURLcode error_code;
-
- curl = curl_easy_init();
- if (curl)
- {
- fp = fopen(download_path, "wb");
- curl_easy_setopt(curl, CURLOPT_URL, download_url);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
- error_code = curl_easy_perform(curl);
- FWR_LOGI("curl_easy_perform() [%s][%d]", curl_easy_strerror(error_code), error_code);
- curl_easy_cleanup(curl);
- fclose(fp);
-
- if (error_code != CURLE_OK) {
- remove(download_path);
- ret = -1;
- }
- } else {
- ret = -1;
- }
-
- FWR_EXIT
- return ret;
-}
+++ /dev/null
-#include <app_common.h>
-#include <fmwup_resource_internal.h>
-
-extern fmwup_s* g_firmware_resource;
-extern char *g_download_path;
-extern state_changed_cb g_state_changed_cb;
-
-#define UPDATE_FILE "/opt/usr/data/fota/tota_init"
-#define FIRMWARE_FILE_NAME "fmwup.zip"
-
-#ifdef _USE_WWST_
-#define REST_API_DOWNLOAD_URL "/api/v1/fota/downloadUrl/"
-#define CURRENT_VERSION "?currentVersion="
-#define TOKEN "&token="
-#define TOKEN_KEY_TEMP "ZjExNGM1MGUtMWE5YS00NDJiLWE2ZGItNmUzZGM0Y2I4MGE4LnppcA=="
-#endif
-
-char *g_app_data_path = NULL;
-
-
-bool _parse_secure_url(char *json, char **url_value)
-{
- if (!json && *json != '{' && *(json+1) != '\"') {
-
- return false;
- }
-
- char *ret_str;
- ret_str = strtok(json,"{\"");
-
- if (ret_str == NULL && g_strcmp0(ret_str, "url") != 0) {
- FWR_LOGE("Invalid json [url]");
- return false;
- }
-
- ret_str = strtok(NULL,"\"");
- if (ret_str == NULL && g_strcmp0(ret_str, ":") != 0) {
- FWR_LOGE("Invalid delimeter [:]");
- return false;
- }
-
- ret_str = strtok(NULL,"\"");
- if (ret_str == NULL)
- return false;
-
- *url_value = g_strdup(ret_str);
-
- return true;
-}
-
-bool _compare_resource_interface(char *from, char *iface)
-{
- char *str = g_strdup(from);
- char *ptr = strtok(str, ";");
-
- if(ptr == NULL) {
- return false;
- }
-
- do {
- if(strstr(ptr, ".if.")) {
- char *if_ptr = NULL;
- if_ptr = strtok(ptr, "=");
- if_ptr = strtok(NULL, "=");
-
- if(!g_strcmp0(if_ptr, iface)) {
- return true;
- }
- }
- } while ((ptr = strtok(NULL, ";")));
-
- return false;
-}
-
-
-OCEntityHandlerResult _check_request_payload(OCEntityHandlerRequest *ehRequest)
-{
- if( !(ehRequest->query) || \
- (ehRequest->query && (g_strcmp0(ehRequest->query, "") && \
- !_compare_resource_interface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))))
- {
- FWR_LOGE("Not supported Interface");
- return OC_EH_BAD_REQ;
- }
-
- return OC_EH_OK;
-}
-
-
-static void _exec_update()
-{
- FILE* fp = fopen(UPDATE_FILE, "w");
- if(!fp) {
- FWR_LOGE("fopen error: %d", errno);
- return;
- }
- fclose(fp);
-}
-
-
-void fmwup_propagate_firmware_resource(void)
-{
- if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_firmware_resource->resource_handle, OC_HIGH_QOS)) {
- FWR_LOGD("Firmware-Resource doesn't have any observers.");
- }
-}
-
-
-void fmwup_propagate_firmware_status_resource(fmwup_update_property_e state, fmwup_result_property_e result, bool is_new_firmware)
-{
-
- g_firmware_resource->state = state;
- g_firmware_resource->result = result;
-
- vconf_set_int(VCONF_FIRMWARE_UPDATE_STATE, (const int)g_firmware_resource->state);
- vconf_set_int(VCONF_FIRMWARE_UPDATE_RESULT, (const int)g_firmware_resource->result);
-
- fmwup_propagate_firmware_resource();
-
- if (g_state_changed_cb) {
- g_state_changed_cb(g_firmware_resource->state, is_new_firmware);
- }
-
- if (!(result == FMWUP_RESULT_INITIAL)) {
- //init state, result in failed case
- g_firmware_resource->state = FMWUP_STATE_IDLE;
- g_firmware_resource->result = FMWUP_RESULT_INITIAL;
-
- vconf_set_int(VCONF_FIRMWARE_UPDATE_STATE, (const int)g_firmware_resource->state);
- vconf_set_int(VCONF_FIRMWARE_UPDATE_RESULT, (const int)g_firmware_resource->result);
-
- fmwup_propagate_firmware_resource();
- }
-}
-
-
-void _handle_update_command(int64_t update_type)
-{
- int result = FMWUP_RESULT_INITIAL;
-#ifdef _USE_WWST_
- char *res_header = NULL;
- char *res_body = NULL;
- char *request_uri = NULL;
- char *sec_download_url = NULL;
- char *download_path = NULL;
-#endif
-
- if (g_strcmp0(g_firmware_resource->package_uri, "") == 0 ||
- g_strcmp0(g_firmware_resource->new_version, "") == 0 ||
- g_strcmp0(g_firmware_resource->current_version, g_firmware_resource->new_version) == 0)
- {
- FWR_LOGE("Invalid value, package_uri[%s], new_version[%s], current_version[%s]",
- g_firmware_resource->package_uri, g_firmware_resource->new_version, g_firmware_resource->current_version);
- result = FMWUP_RESULT_UPDATE_FAILED;
- goto _END_OF_FUNC_;
- }
-
-
- if ((g_firmware_resource->state == FMWUP_STATE_IDLE) && (update_type == FMWUP_EXEC_DOWNLOAD || update_type == FMWUP_EXEC_DOWNLOAD_AND_UPGRADE)) {
- FWR_LOGD("***Downloading image from [%s] ***", g_firmware_resource->package_uri);
- fmwup_propagate_firmware_status_resource(FMWUP_STATE_DOWNLOADING, FMWUP_RESULT_INITIAL, true);
-
-#ifdef _USE_WWST_
-
- //request_uri = g_strconcat(g_firmware_resource->package_uri, REST_API_DOWNLOAD_URL, CURRENT_VERSION,
- // g_firmware_resource->current_version, TOKEN, TOKEN_KEY_TEMP, NULL);
- request_uri = g_strconcat(g_firmware_resource->package_uri, NULL);
- download_path = g_strconcat(g_download_path, FIRMWARE_FILE_NAME, NULL);
-
- FWR_LOGI("request_uri[%s]", request_uri);
-
- if (fmwup_http_send_request(FMWUP_HTTP_GET, request_uri, &res_header, &res_body) != 0) {
- FWR_LOGE("cannot get Secure URL");
- result = FMWUP_RESULT_INVALID_URL;
- goto _END_OF_FUNC_;
- } else {
- //parsing
- FWR_LOGI("res_header[%s] res_body[%s]",res_header, res_body);
-
- if (_parse_secure_url(res_body, &sec_download_url)) {
- FWR_LOGI("download url[%s] download path[%s]",sec_download_url, download_path);
-
- if (fmwup_http_download_file(sec_download_url, (const char *)download_path) != 0) {
- FWR_LOGE("fmwup_http_download_file failed");
- result = FMWUP_RESULT_INVALID_URL;
- goto _END_OF_FUNC_;
- }
-
- } else {
- FWR_LOGE("_parse_secure_url failed");
- result = FMWUP_RESULT_INVALID_URL;
- goto _END_OF_FUNC_;
- }
- }
-
-#else
- if (fmwup_http_download_file(g_firmware_resource->package_uri, (const char *)g_download_path) != 0) {
- FWR_LOGE("fmwup_http_download_file failed");
- result = FMWUP_RESULT_INVALID_URL;
- goto _END_OF_FUNC_;
- }
-#endif
-
- FWR_LOGD("*** Firmware image downloaded ***");
- fmwup_propagate_firmware_status_resource(FMWUP_STATE_DOWNLOADED, FMWUP_RESULT_INITIAL, true);
- }
-
- if ((g_firmware_resource->state == FMWUP_STATE_DOWNLOADED) &&
- (update_type == FMWUP_EXEC_UPGRADE || update_type == FMWUP_EXEC_DOWNLOAD_AND_UPGRADE)) {
- fmwup_propagate_firmware_status_resource(FMWUP_STATE_UPDATING, FMWUP_RESULT_INITIAL, true);
-
- //TODO: To upgrade using interface of fota-client
- _exec_update();
- }
-
-_END_OF_FUNC_:
- if (result != FMWUP_RESULT_INITIAL) {
- fmwup_propagate_firmware_status_resource(FMWUP_STATE_IDLE, result, true);
- }
-
-#ifdef _USE_WWST_
- g_free(res_header);
- g_free(res_body);
- g_free(download_path);
- g_free(sec_download_url);
- g_free(request_uri);
-#endif
-
- return;
-}
-
-OCRepPayload* _construct_response_of_firmware()
-{
- FWR_ENTER
- OCRepPayload* payload = OCRepPayloadCreate();
- if (!payload) {
- FWR_LOGE("Failed to allocate Payload");
- return NULL;
- }
-
- OCRepPayloadSetUri(payload, OC_RSRVD_FIRMWARE_URI);
-
- OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
- OCRepPayloadAddResourceType(payload, OC_RSRVD_FIRMWARE_RES_TYPE);
-
- OCRepPayloadSetPropInt(payload, OC_RSRVD_FIRMWARE_STATE, (int64_t)g_firmware_resource->state);
- OCRepPayloadSetPropInt(payload, OC_RSRVD_FIRMWARE_RESULT, (int64_t)g_firmware_resource->result);
- OCRepPayloadSetPropInt(payload, OC_RSRVD_FIRMWARE_UPDATE, (int64_t)g_firmware_resource->update);
- OCRepPayloadSetPropInt(payload, OC_RSRVD_FIRMWARE_PROGRESS, (int64_t)g_firmware_resource->progress);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_UPDATE_TIME, g_firmware_resource->update_time);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_DESCRIPTION, g_firmware_resource->description);
-
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_CURRENT_VERSION, g_firmware_resource->current_version);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_NEW_VERSION, g_firmware_resource->new_version);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_PACKAGE_URI, g_firmware_resource->package_uri);
- OCRepPayloadSetPropInt(payload, OC_RSRVD_FIRMWARE_PACKAGE_SIZE, g_firmware_resource->package_size);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_PACKAGE_MD5, g_firmware_resource->package_md5);
-
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_VENDER, g_firmware_resource->manufacturer);
- OCRepPayloadSetPropString(payload, OC_RSRVD_FIRMWARE_MODEL, g_firmware_resource->model_name);
-
- OCRepPayloadSetPropBool(payload, OC_RSRVD_FIRMWARE_ACTIVE_CHECK, g_firmware_resource->active_check);
-
- FWR_EXIT
- return payload;
-}
-
-void *_worker(void *data)
-{
- int64_t exec_type = *(int64_t *)data;
- _handle_update_command(exec_type);
- g_free(data);
-
- return NULL;
-}
-
-
-void _update_firmware_resource(OCRepPayload *input)
-{
-
- /* write to non volatile data - package info */
- char *new_firmware = NULL;
- if (OCRepPayloadGetPropString(input, OC_RSRVD_FIRMWARE_NEW_VERSION, &new_firmware)) {
- if (g_strcmp0(new_firmware, g_firmware_resource->new_version)) {
- g_free(g_firmware_resource->new_version);
- g_firmware_resource->new_version = g_strdup(new_firmware);
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_NEW_VERSION, new_firmware);
- }
- g_free(new_firmware);
- FWR_LOGI("g_firmware_resource->new_version = [%s]", g_firmware_resource->new_version);
-
- char *package_uri = NULL;
- if (OCRepPayloadGetPropString(input, OC_RSRVD_FIRMWARE_PACKAGE_URI, &package_uri)) {
- if (g_strcmp0(package_uri, g_firmware_resource->package_uri)) {
- g_free(g_firmware_resource->package_uri);
- g_firmware_resource->package_uri = g_strdup(package_uri);
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_URL, package_uri);
- }
- g_free(package_uri);
- FWR_LOGI("g_firmware_resource->package_uri = [%s]", g_firmware_resource->package_uri);
- } else {
- FWR_LOGE("package_uri none");
- }
-
- int64_t package_size;
- if (OCRepPayloadGetPropInt(input, OC_RSRVD_FIRMWARE_PACKAGE_SIZE, &package_size)) {
- g_firmware_resource->package_size = package_size;
- vconf_set_dbl(VCONF_FIRMWARE_UPDATE_PACKAGE_SIZE, (double)package_size);
- FWR_LOGI("g_firmware_resource->package_size = [%lld]", package_size);
- } else {
- FWR_LOGI("package_size none");
- }
-
- char *package_md5 = NULL;
- if (OCRepPayloadGetPropString(input, OC_RSRVD_FIRMWARE_PACKAGE_MD5, &package_md5)) {
- if (g_strcmp0(package_md5, g_firmware_resource->package_md5)) {
- g_free(g_firmware_resource->package_md5);
- g_firmware_resource->package_md5 = g_strdup(package_md5);
- vconf_set_str(VCONF_FIRMWARE_UPDATE_PACKAGE_MD5, package_md5);
- }
- g_free(package_md5);
- FWR_LOGI("g_firmware_resource->package_md5 = [%s]", g_firmware_resource->package_md5);
- } else {
- FWR_LOGI("package_md5 none");
- }
-
- if (g_state_changed_cb) {
- g_state_changed_cb(g_firmware_resource->state, true);
- }
- }
-
-
- /* write to volatile data - update info */
- char *update_time = NULL;
- if (OCRepPayloadGetPropString(input, OC_RSRVD_FIRMWARE_UPDATE_TIME, &update_time)) {
- if (g_strcmp0(update_time, g_firmware_resource->update_time)) {
- g_free(g_firmware_resource->update_time);
- g_firmware_resource->update_time = g_strdup(update_time);
- }
-
- g_free(update_time);
- FWR_LOGI("g_firmware_resource->update_time = [%s]", g_firmware_resource->update_time);
- /* TODO : Check Scheduled update , */
- }
-
- char *description = NULL;
- if (OCRepPayloadGetPropString(input, OC_RSRVD_FIRMWARE_DESCRIPTION, &description)) {
- if (g_strcmp0(description, g_firmware_resource->description)) {
- g_free(g_firmware_resource->description);
- g_firmware_resource->description = g_strdup(description);
- }
-
- g_free(description);
- FWR_LOGI("g_firmware_resource->description = [%s]", g_firmware_resource->description);
- }
-
- int64_t update;
- if (OCRepPayloadGetPropInt(input, OC_RSRVD_FIRMWARE_UPDATE, &update)) {
- FWR_LOGD("update command = [%lld]", update);
- fmwup_update_command(update);
- }
-
- fmwup_propagate_firmware_resource();
-}
-
-
-int fmwup_update_command(int64_t update_type)
-{
- int64_t *update = (int64_t *)calloc(1, sizeof(int64_t));
- if (!update) {
- FWR_LOGE("Memory allocation error!");
- return -1;
- }
-
- g_firmware_resource->update = (int)update_type;
-
- *update = update_type;
-
- pthread_t pThread;
- pthread_create(&pThread, NULL, _worker, update);
-
- return 0;
-}
-
-
-OCEntityHandlerResult _process_get_request(OCEntityHandlerRequest *ehRequest, OCRepPayload **payload)
-{
- OCRepPayload *getResp = _construct_response_of_firmware(ehRequest);
- if (!getResp)
- {
- FWR_LOGD("constructResponse failed");
- return OC_EH_ERROR;
- }
-
- *payload = getResp;
-
- return OC_EH_OK;
-}
-
-
-OCEntityHandlerResult _process_post_request(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload)
-{
- FWR_ENTER
- OCEntityHandlerResult ehResult = OC_EH_ERROR;
- if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) {
- FWR_LOGE("Incoming payload not a representation");
- return ehResult;
- }
-
- OCRepPayload* input = (OCRepPayload*)(ehRequest->payload);
- if (!input) {
- FWR_LOGE("Failed to parse");
- return ehResult;
- }
-
- _update_firmware_resource(input);
-
- OCRepPayload *getResp = NULL;
- getResp = _construct_response_of_firmware();
-
- if (!getResp) {
- FWR_LOGD("constructResponse failed");
- return OC_EH_ERROR;
- }
-
- *payload = getResp;
- ehResult = OC_EH_OK;
-
- FWR_EXIT
- return ehResult;
-}
-
-
-OCEntityHandlerResult fmwup_handle_firmware_entity(OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest,
- void *callbackParam)
-{
- OCEntityHandlerResult ehRet = OC_EH_OK;
- OCEntityHandlerResponse response = { 0, 0, OC_EH_ERROR, 0, 0, \
- { }, { 0 }, false };
- OCRepPayload* payload = NULL;
-
- if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) {
- if (OC_REST_GET == entityHandlerRequest->method) {
- FWR_LOGD("Received OC_REST_GET request");
- ehRet = _process_get_request(entityHandlerRequest, &payload);
- } else if (OC_REST_PUT == entityHandlerRequest->method) {
- FWR_LOGD("Received OC_REST_PUT request, nothing to do");
- } else if (OC_REST_POST == entityHandlerRequest->method) {
- FWR_LOGD("Received OC_REST_POST from client");
- ehRet = _process_post_request(entityHandlerRequest, &payload);
- }
-
- if (ehRet == OC_EH_OK) {
- response.requestHandle = entityHandlerRequest->requestHandle;
- response.resourceHandle = entityHandlerRequest->resource;
- response.ehResult = ehRet;
- response.payload = (OCPayload*)payload;
- response.persistentBufferFlag = 0;
-
- // Send the response
- if (OCDoResponse(&response) != OC_STACK_OK) {
- FWR_LOGE("Error sending response");
- ehRet = OC_EH_ERROR;
- }
-
- if (OC_REST_POST == entityHandlerRequest->method || OC_REST_PUT == entityHandlerRequest->method) {
- if (OCNotifyAllObservers(g_firmware_resource->resource_handle, OC_NA_QOS) != OC_STACK_OK) {
- FWR_LOGI("Fail to OCNotifyAllObservers()");
- ehRet = OC_EH_ERROR;
- }
- }
- }
- }
-
- if (entityHandlerRequest && (flag & OC_OBSERVE_FLAG)) {
- FWR_LOGD("Flag includes OC_OBSERVE_FLAG");
- if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action) {
- FWR_LOGD("Received OC_OBSERVE_REGISTER from client");
- } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action) {
- FWR_LOGD("Received OC_OBSERVE_DEREGISTER from client");
- }
- }
-
- return ehRet;
-}
-
-
-void fmwup_get_firmware_info(fmwup_s *firmware_info)
-{
- int update_state;
- int update_result;
-
- char *cur_firmware_ver = NULL;
- char *new_firmware_ver = NULL;
- double package_size = 0;
- char *package_md5 = NULL;
- char *download_url = NULL;
-
- char *manufacturer = NULL;
- char *model_name = NULL;
-
-#if 1
- OCGetPropertyValue(PAYLOAD_TYPE_PLATFORM, OC_RSRVD_MFG_NAME, (void **)&manufacturer);
- OCGetPropertyValue(PAYLOAD_TYPE_PLATFORM, OC_RSRVD_MODEL_NUM, (void **)&model_name);
- OCGetPropertyValue(PAYLOAD_TYPE_PLATFORM, OC_RSRVD_FIRMWARE_VERSION, (void **)&cur_firmware_ver);
-#else
- if (system_info_get_platform_string("http://tizen.org/system/manufacturer", &manufacturer)
- != SYSTEM_INFO_ERROR_NONE) {
- FWR_LOGD("system_info_get_platform_string() is failed");
- }
-
- if (system_info_get_platform_string("http://tizen.org/system/model_name", &model_name)
- != SYSTEM_INFO_ERROR_NONE) {
- FWR_LOGD("system_info_get_platform_string() is failed");
- }
-
- if (system_info_get_platform_string("http://tizen.org/system/build.version.release", &cur_firmware_ver)
- != SYSTEM_INFO_ERROR_NONE) {
- FWR_LOGD("system_info_get_platform_string() is failed");
- }
-#endif
-
- if (vconf_get_int(VCONF_FIRMWARE_UPDATE_STATE, &update_state) != 0) {
- FWR_LOGE("vconf_get_int() is failed");
- }
-
- if (vconf_get_int(VCONF_FIRMWARE_UPDATE_RESULT, &update_result) != 0) {
- FWR_LOGE("vconf_get_int() is failed");
- }
-
- if (vconf_get_dbl(VCONF_FIRMWARE_UPDATE_PACKAGE_SIZE, &package_size) != 0) {
- FWR_LOGE("vconf_get_dbl() is failed");
- }
- new_firmware_ver = vconf_get_str(VCONF_FIRMWARE_UPDATE_PACKAGE_NEW_VERSION);
- package_md5 = vconf_get_str(VCONF_FIRMWARE_UPDATE_PACKAGE_MD5);
- download_url = vconf_get_str(VCONF_FIRMWARE_UPDATE_PACKAGE_URL);
-
- FWR_LOGD("firmware_update_state=[%d]", update_state);
- FWR_LOGD("firmware_update_result=[%d]", update_result);
-
- FWR_LOGD("firmware_ver=[%s]", cur_firmware_ver);
- FWR_LOGD("firmware_new_ver=[%s]", new_firmware_ver);
- FWR_LOGD("firmware_package_url=[%s]", download_url);
- FWR_LOGD("firmware_md5=[%s]", package_md5);
- FWR_LOGD("firmware_package_size=[%lld]", (int64_t)package_size);
-
- FWR_LOGD("manufacturer=[%s]", manufacturer);
- FWR_LOGD("model_name=[%s]", model_name);
-
- firmware_info->state = update_state;
- firmware_info->result = update_result;
- firmware_info->update_time = g_strdup("");
- firmware_info->description = g_strdup("");
-
- firmware_info->current_version = g_strdup(cur_firmware_ver);
- firmware_info->new_version = g_strdup(new_firmware_ver);
- firmware_info->package_uri = g_strdup(download_url);
- firmware_info->package_size = (int64_t)package_size;
- firmware_info->package_md5 = g_strdup(package_md5);
-
- firmware_info->manufacturer = g_strdup(manufacturer);
- firmware_info->model_name = g_strdup(model_name);
-
- firmware_info->active_check = false;
-
- g_free(manufacturer);
- g_free(model_name);
-
- g_free(package_md5);
- g_free(new_firmware_ver);
- g_free(cur_firmware_ver);
- g_free(download_url);
-}
-
+++ /dev/null
-set(testapp "fmwup_test")
-
-#ADD_DEFINITIONS(-D__WITH_DTLS__ -D__WITH_TLS__ -DRD_CLIENT -D_USE_WWST_)
-ADD_DEFINITIONS(-DRD_CLIENT)
-
-SET(FMWUP_TEST_SRCS
- ${CMAKE_CURRENT_SOURCE_DIR}/fmwup_test.c
-)
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../inc)
-
-#INSTALL(FILES ${CMAKE_BINARY_DIR}/test/thawte.cert.pem DESTINATION /opt/usr/data/ua-client/)
-#INSTALL(FILES ${CMAKE_BINARY_DIR}/test/oic_svr_db_client.dat DESTINATION /opt/usr/data/ua-client/)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(test_pkgs REQUIRED glib-2.0 iotivity key-manager)
-INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
-
-FIND_LIBRARY(RD_LIB NAMES resource_directory PATHS /usr/lib)
-SET(LIBNAME fmwup-resource)
-ADD_EXECUTABLE(${testapp} ${FMWUP_TEST_SRCS})
-TARGET_LINK_LIBRARIES(${testapp} ${test_pkgs_LIBRARIES} ${LIBNAME} ${RD_LIB} -lpthread)
-
-INSTALL(TARGETS ${testapp} DESTINATION bin/)
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-#include <gio/gio.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <pthread.h>
-
-#include <ocstack.h>
-#include <ocpayload.h>
-#include <octypes.h>
-#include <rd_client.h>
-#ifdef _USE_WWST_
-#include <oickeepalive.h>
-#endif
-#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
-#include <ocprovisioningmanager.h>
-#endif
-
-#include <ckmc/ckmc-manager.h>
-
-#include <fmwup_resource.h>
-
-
-#define DEFAULT_CONTEXT_VALUE 0x99
-#define LOGIN_OK 4
-
-#define OC_FMWUP_DAT_FILE_PATH "/opt/usr/data/ua-client/oic_svr_db_client.dat"
-#ifdef _USE_WWST_
-#define OC_SECURITY_SQL_DB_FILE_NAME "/opt/usr/data/ua-client/PDM.db"
-#define CERT_FILE_PATH "/opt/usr/data/ua-client/thawte.cert.pem"
-#endif
-
-OCResourceHandle res_handle[2];
-
-OCPersistentStorage *ps;
-
-#ifdef _USE_WWST_
-#define CLOUD_STG_SERVER "52.202.112.20:443"
-#define CLOUD_DEV_SERVER "54.86.109.131:443"
-#define CLOUD_AUTH_PROVIDER "samsung-us"
-#define CLOUD_DEVICE_TYPE "device"
-#define CLOUD_PROTOCOL "coaps+tcp://"
-#else
-#define CLOUD_STG_SERVER "52.78.68.250:5683"
-#define CLOUD_AUTH_PROVIDER "tdc"
-#define CLOUD_PROTOCOL "coap+tcp://"
-#endif
-
-#define DEVICE_ID "di"
-#define CLIENT_ID "clientid"
-#define AUTH_PROVIDER "authprovider"
-#define DEVICE_TYPE "devicetype"
-#define ACCESS_TOKEN "accesstoken"
-#define USER_ID "uid"
-#define CLOUD_LOGIN "login"
-#define AUTH_CODE "authcode"
-
-#define CLOUD_ACCOUNT_RES_TYPE "oic.wk.account"
-#define CLOUD_SESSION_RES_TYPE "oic.wk.session"
-
-#define MAX_INTERVAL_NUMBER (4)
-
-typedef struct
-{
- char *deviceId;
- char *clientId;
- char *authCode;
- char *uid;
- char *accessToken;
- char *refreshToken;
- char *codeVerifier;
-
-#ifdef _USE_WWST_
- uint8_t *certificate;
- size_t certificateLength;
- OicEncodingType_t encodingType;
-#endif
-} CloudLoginInfo;
-
-bool g_auto_publish;
-bool bSignin;
-bool isExit;
-uint16_t g_cred_id = 0;
-CloudLoginInfo loginDetails;
-
-static pthread_mutex_t pingcycle_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
-static bool is_ping_timer = false;
-
-
-OCPlatformInfo g_platform_info = {
- "1234", /* platformID */
- "Samsung", /* manufacturerName */
- "https://www.example.com", /* manufacturerUrl */
- "Tizen2017-AAA", /* modelNumber */
- "2017-07-19", /* dateOfManufacture */
- "AAA", /* platformVersion */
- "4.0", /* operatingSystemVersion */
- "HW-001", /* hardwareVersion */
- "1.0", /* firmwareVersion */
- "https://www.examplesupport.com", /* supportUrl */
- "2017-07-19T12.00" /* systemTime */
-};
-
-bool switch_power;
-
-
-int _signin();
-int _signup();
-int _publish_fw_res_to_rd();
-
-int _set_auth_cert_info()
-{
-#ifdef _USE_WWST_
- char *certFile = CERT_FILE_PATH;
- ckmc_cert_s* cert = NULL;
- int ret_cert = ckmc_load_cert_from_file(certFile, &cert);
- if (CKMC_ERROR_NONE != ret_cert) {
- printf("ckmc_load_cert_from_file error [%d]\n", ret_cert);
- return -1;
- }
-
- loginDetails.certificate = cert->raw_cert;
- loginDetails.certificateLength = cert->cert_size;
- loginDetails.encodingType = OIC_ENCODING_PEM;
-
- if (loginDetails.certificate) {
- printf("Save cert file Data\n");
- if (OCSaveTrustCertChain(loginDetails.certificate, loginDetails.certificateLength, \
- loginDetails.encodingType, &g_cred_id) != OC_STACK_OK) {
- printf("OCSaveTrustCertChain() failed\n");
- return -1;
- } else {
- printf("Cred ID from saveCertFile = [%d]\n", g_cred_id);
- }
- }
-#endif
- return 0;
-}
-
-void _lock_and_wait()
-{
- pthread_mutex_init(&_lock, NULL);
- pthread_cond_init(&_cond, NULL);
-
- pthread_mutex_lock(&_lock);
- pthread_cond_wait(&_cond, &_lock);
- pthread_mutex_unlock(&_lock);
-}
-
-void _cond_signal()
-{
- pthread_mutex_lock(&_lock);
- pthread_cond_signal(&_cond);
- pthread_mutex_unlock(&_lock);
-}
-
-static FILE *_client_open(const char *path, const char *mode)
-{
- (void)path;
-
- if (!strcmp(mode, "rb"))
- mode = strdup("r");
- else if(!strcmp(mode, "wb"))
- mode = strdup("w");
-
- printf("path [%s], mode[%s]", path, mode);
- return fopen(OC_FMWUP_DAT_FILE_PATH, mode);
-}
-
-
-static void _parse_payload(OCRepPayload *payload)
-{
- if (!payload)
- return;
-
-#ifdef _USE_WWST_
- char *sid, *certificate;
- if (!OCRepPayloadGetPropString(payload, "sid", &sid))
- printf("Can't get 'sid'\n");
-
- if (!OCRepPayloadGetPropString(payload, "certificate", &certificate))
- printf("Can't get 'certificate'\n");
-#else
- if (!OCRepPayloadGetPropString(payload, USER_ID, &loginDetails.uid))
- printf("Can't get 'uid'\n");
-
- if (!OCRepPayloadGetPropString(payload, ACCESS_TOKEN, &loginDetails.accessToken))
- printf("Can't get 'access_token'\n");
-#endif
-
-}
-
-#ifdef _USE_WWST_
-static OCStackApplicationResult _send_keep_alive_cb(void *context, OCDoHandle handle,
- OCClientResponse * clientResponse)
-{
- (void)context;
- (void)handle;
-
- if (!clientResponse) {
- printf("clientResponse is NULL!\n");
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- printf("_send_keep_alive_cb() is called, result=[%d]\n", clientResponse->result);
-
- if(clientResponse->result > OC_STACK_RESOURCE_CHANGED) {
- pthread_detach(pthread_self());
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = false;
- pthread_mutex_unlock(&pingcycle_mutex);
- pthread_exit(NULL);
- }
-
- return OC_STACK_DELETE_TRANSACTION;
-}
-
-static void *_send_keep_alive(void *data)
-{
- OCStackResult ocResult = OC_STACK_ERROR;
- int i = 0;
- int timeout = 0;
- int timer_count = 0;
-
- int64_t *array = (int64_t *)data;
-
- while (is_ping_timer) {
- if(timeout == timer_count) {
- timer_count = 0;
-
- if(i >= MAX_INTERVAL_NUMBER)
- i = MAX_INTERVAL_NUMBER - 1;
-
- OCRepPayload *keepAlivePayload = OCRepPayloadCreate();
- if (!keepAlivePayload) break;
-
- OCRepPayloadSetPropInt(keepAlivePayload, "in", (int64_t)array[i]);
- timeout = array[i] * 60;
- ++i;
-
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s", CLOUD_PROTOCOL, CLOUD_STG_SERVER);
-
- OCCallbackData cbData = {0,};
- cbData.cb = _send_keep_alive_cb;
-
- ocResult = OCSendKeepAliveRequest(NULL, uri, (OCPayload *)keepAlivePayload, &cbData);
- printf("sendKeepAliveRequest() result : %d\n", ocResult);
- if (OC_STACK_OK != ocResult) {
- pthread_detach(pthread_self());
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = false;
- pthread_mutex_unlock(&pingcycle_mutex);
- pthread_exit(NULL);
- }
- }
- pthread_mutex_lock(&pingcycle_mutex);
- ++timer_count;
- pthread_mutex_unlock(&pingcycle_mutex);
- sleep(1);
- }
-
- return NULL;
-}
-
-static void _keep_alive_cb(OCRepPayload *payload)
-{
- printf("_keep_alive_cb() is called\n");
-
- if (!payload)
- return;
-
- int64_t *array = NULL;
- size_t dim[MAX_REP_ARRAY_DEPTH];
- bool ocBoolResult = false;
-
- ocBoolResult = OCRepPayloadGetIntArray(payload, "inarray", &array, dim);
- printf("OCRepPayloadGetStringArray() return = [%d]\n", ocBoolResult);
-
- if (ocBoolResult == true && array) {
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = true;
- pthread_mutex_unlock(&pingcycle_mutex);
-
- pthread_t _keep_alive_thd;
- pthread_create(&_keep_alive_thd, NULL, _send_keep_alive, (void *)array);
- } else {
- pthread_detach(pthread_self());
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = false;
- pthread_mutex_unlock(&pingcycle_mutex);
- pthread_exit(NULL);
- }
-
- return;
-}
-#endif
-
-void _set_platform_info()
-{
- printf("_set_platform_info() is called\n");
-
- if (OCSetPlatformInfo(g_platform_info) == OC_STACK_OK) {
- printf("Platform Registration is succeeded\n");
- } else {
- printf("Platform Registration is failed\n");
- }
-}
-
-
-void _set_device_info()
-{
- printf("_set_device_info() is called\n");
-
- OCDeviceInfo devInfoAirConditioner;
- OCStringLL deviceType;
-
-#ifdef _USE_WWST_
- deviceType.value = g_strdup("oic.d.switch");
-#else
- deviceType.value = g_strdup("oic.d.airconditioner");
-#endif
-
- deviceType.next = NULL;
- devInfoAirConditioner.deviceName = g_strdup("FAC_2016");
- devInfoAirConditioner.types = &deviceType;
- devInfoAirConditioner.specVersion = NULL;
- devInfoAirConditioner.dataModelVersions = NULL;
-
- if (OCSetDeviceInfo(devInfoAirConditioner) != OC_STACK_OK) {
- printf("OCSetDeviceInfo() failed\n");
- } else {
- printf("OCSetDeviceInfo() Success\n");
- }
-}
-
-void _get_login_info()
-{
-#ifdef _USE_WWST_
- char tmp[64];
-
- printf("Enter access_token : ");
- memset(tmp, 0x00, sizeof(tmp));
- scanf("%s", tmp);
- loginDetails.accessToken = g_strdup(tmp);
- printf("access_token : %s\n", loginDetails.accessToken);
-
- printf("Enter refresh_token : ");
- memset(tmp, 0x00, sizeof(tmp));
- scanf("%s", tmp);
- loginDetails.refreshToken = g_strdup(tmp);
- printf("refresh_token : %s\n", loginDetails.refreshToken);
-
- printf("Enter user_id : ");
- memset(tmp, 0x00, sizeof(tmp));
- scanf("%s", tmp);
- loginDetails.uid = g_strdup(tmp);
- printf("user_id : %s\n", loginDetails.uid);
-
- printf("Enter client_id : ");
- memset(tmp, 0x00, sizeof(tmp));
- scanf("%s", tmp);
- loginDetails.clientId = g_strdup(tmp);
- printf("client_id : %s\n", loginDetails.clientId);
-#endif
- loginDetails.deviceId = g_strdup(OCGetServerInstanceIDString());
- printf("Device ID = [%s]\n", loginDetails.deviceId);
-
-}
-
-#ifdef _USE_WWST_
-static OCStackApplicationResult _handle_keepalive_cb(void *context, OCDoHandle handle,
- OCClientResponse * clientResponse)
-{
- (void)context;
- (void)handle;
-
- if (!clientResponse) {
- printf("Received NULL clientResponse\n");
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- if (clientResponse->result == OC_STACK_OK) {
- _keep_alive_cb((OCRepPayload*)clientResponse->payload);
- }
-
- return OC_STACK_KEEP_TRANSACTION;
-}
-
-
-void *_ping_timer(void *timer)
-{
- OCStackResult ocResult = OC_STACK_ERROR;
- (void)timer;
-
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s", CLOUD_PROTOCOL, CLOUD_STG_SERVER);
-
- OCCallbackData keepAliveCb = {0,};
- keepAliveCb.cb = _handle_keepalive_cb;
- ocResult = OCFindKeepAliveResource(NULL, uri, &keepAliveCb);
- printf("OCFindKeepAliveResource() result : %d\n", ocResult);
-
- if (OC_STACK_OK != ocResult) {
- pthread_detach(pthread_self());
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = false;
- pthread_mutex_unlock(&pingcycle_mutex);
- pthread_exit(NULL);
- }
-
- return NULL;
-}
-#endif
-
-static OCStackApplicationResult _handle_signin_response(void *ctx,
- OCDoHandle handle,
- OCClientResponse *response)
-{
- (void)(ctx);
- (void)(handle);
-
- if (!response) {
- printf("Received NULL response\n");
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- if (response->payload) {
- printf("Payload received\n");
- }
-
- if (response->result != LOGIN_OK) {
- printf("Login error: %d\n", response->result);
-
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = false;
- pthread_mutex_unlock(&pingcycle_mutex);
- } else {
- bSignin = true;
- printf("Sign-In Success!!!\n");
-
- sleep(1);
- if (g_auto_publish) {
- if (_publish_fw_res_to_rd() != 0) {
- printf("publish failed!!!\n");
- }
- }
-
-#ifdef _USE_WWST_
- pthread_t pingThread;
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = true;
- pthread_mutex_unlock(&pingcycle_mutex);
-
- int ret = pthread_create(&pingThread, NULL, _ping_timer, NULL);
- if (ret != 0)
- printf("ping pthread_create fail!\n");
-#endif
- }
-
- return OC_STACK_KEEP_TRANSACTION;
-
-}
-
-static OCStackApplicationResult _handle_signup_response(void *ctx,
- OCDoHandle handle,
- OCClientResponse *response)
-{
- (void)(ctx);
- (void)(handle);
-
- if (!response) {
- printf("Received NULL response\n");
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- if (response->result != LOGIN_OK) {
- printf("Login error: %d\n", response->result);
- } else {
- _parse_payload((OCRepPayload*)response->payload);
- printf("Sign-Up OK!!!\n");
- sleep(1);
- _signin();
- }
-
- return OC_STACK_KEEP_TRANSACTION;
-}
-
-
-static OCStackApplicationResult _handle_signout_response(void *ctx,
- OCDoHandle handle,
- OCClientResponse *response)
-{
- (void)(ctx);
- (void)(handle);
-
- if (response) {
- if (response->result == LOGIN_OK)
- printf("Sign-Out Success!!!\n");
- else
- printf("Sign-Out Failed [%d]!!!\n", response->result);
- }
-
- bSignin = false;
- pthread_mutex_lock(&pingcycle_mutex);
- is_ping_timer = FALSE;
- pthread_mutex_unlock(&pingcycle_mutex);
-
- return OC_STACK_DELETE_TRANSACTION;
-}
-
-
-int _signin()
-{
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s%s?rt=%s;if=%s",
- CLOUD_PROTOCOL, CLOUD_STG_SERVER, OC_RSRVD_ACCOUNT_SESSION_URI, CLOUD_SESSION_RES_TYPE, OC_RSRVD_INTERFACE_DEFAULT);
- printf("server uri=[%s]\n", uri);
-
- OCCallbackData cbData;
- memset(&cbData, 0, sizeof(OCCallbackData));
- cbData.cb = _handle_signin_response;
- cbData.cd = NULL;
- cbData.context = (void *) DEFAULT_CONTEXT_VALUE;
-
- OCRepPayload *payload = OCRepPayloadCreate();
- if (!payload) return -1;
-
- OCRepPayloadSetPropString(payload, DEVICE_ID, (const char *)loginDetails.deviceId);
- OCRepPayloadSetPropString(payload, ACCESS_TOKEN, (const char *)loginDetails.accessToken);
- OCRepPayloadSetPropString(payload, USER_ID, (const char *)loginDetails.uid);
- OCRepPayloadSetPropBool(payload, CLOUD_LOGIN, true);
-// OCRepPayloadAddResourceType(payload, CLOUD_SESSION_RES_TYPE);
-// OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-
- int ret;
- if (OCDoResource(NULL, OC_REST_POST, uri, NULL, (OCPayload *)payload,
- CT_ADAPTER_TCP|CT_IP_USE_V4, OC_LOW_QOS, &cbData, NULL, 0) == OC_STACK_OK) {
- ret = 0;
- printf("OCDoResource() is succeeded\n");
- } else {
- ret = -1;
- printf("OCDoResource() is failed\n");
- }
-
- return ret;
-}
-
-
-int _signup()
-{
-
- if (bSignin == true) {
- printf("Already signed-in!\n");
- return -1;
- }
-
- memset(&loginDetails, 0x00, sizeof(CloudLoginInfo));
- _get_login_info();
-
- _set_auth_cert_info();
-
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s%s?rt=%s;if=%s",
- CLOUD_PROTOCOL, CLOUD_STG_SERVER, OC_RSRVD_ACCOUNT_URI, CLOUD_ACCOUNT_RES_TYPE, OC_RSRVD_INTERFACE_DEFAULT);
- printf("server uri=[%s]\n", uri);
-
- OCCallbackData cbData;
- memset(&cbData, 0, sizeof(OCCallbackData));
- cbData.cb = _handle_signup_response;
- cbData.cd = NULL;
- cbData.context = (void *) DEFAULT_CONTEXT_VALUE;
-
- OCRepPayload *payload = OCRepPayloadCreate();
- if (!payload) return -1;
-
- OCRepPayloadSetPropString(payload, AUTH_PROVIDER, CLOUD_AUTH_PROVIDER);
-#ifdef _USE_WWST_
- OCRepPayloadSetPropString(payload, DEVICE_TYPE, CLOUD_DEVICE_TYPE);
- OCRepPayloadSetPropString(payload, DEVICE_ID, (const char *)loginDetails.deviceId);
- OCRepPayloadSetPropString(payload, CLIENT_ID, (const char *)loginDetails.clientId);
- OCRepPayloadSetPropString(payload, ACCESS_TOKEN, (const char *)loginDetails.accessToken);
- OCRepPayloadSetPropString(payload, USER_ID, (const char *)loginDetails.uid);
-// OCRepPayloadAddResourceType(payload, CLOUD_ACCOUNT_RES_TYPE);
-// OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT);
-#else
- OCRepPayloadSetPropString(payload, AUTH_CODE, "123123123");
- OCRepPayloadSetPropString(payload, DEVICE_ID, loginDetails.deviceId);
-#endif
-
- int ret;
- if (OCDoResource(NULL, OC_REST_POST, uri, NULL, (OCPayload *)payload,
- CT_ADAPTER_TCP|CT_IP_USE_V4, OC_LOW_QOS, &cbData, NULL, 0) == OC_STACK_OK) {
- ret = 0;
- printf("OCDoResource() is succeeded\n");
- } else {
- ret = -1;
- printf("OCDoResource() is failed\n");
- }
-
- return ret;
-}
-
-
-int _signout()
-{
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s%s",
- CLOUD_PROTOCOL, CLOUD_STG_SERVER, OC_RSRVD_ACCOUNT_SESSION_URI);
- printf("server uri=[%s]\n", uri);
-
- OCCallbackData cbData;
- memset(&cbData, 0, sizeof(OCCallbackData));
- cbData.cb = _handle_signout_response;
- cbData.cd = NULL;
- cbData.context = (void *) DEFAULT_CONTEXT_VALUE;
-
- OCRepPayload *payload = OCRepPayloadCreate();
- if (!payload) return -1;
-
- OCRepPayloadSetPropString(payload, DEVICE_ID, (const char *)loginDetails.deviceId);
- OCRepPayloadSetPropString(payload, ACCESS_TOKEN, (const char *)loginDetails.accessToken);
- OCRepPayloadSetPropString(payload, USER_ID, (const char *)loginDetails.uid);
- OCRepPayloadSetPropBool(payload, CLOUD_LOGIN, false);
-
- int ret;
- if (OCDoResource(NULL, OC_REST_POST, uri, NULL, (OCPayload *)payload,
- CT_ADAPTER_TCP|CT_IP_USE_V4, OC_LOW_QOS, &cbData, NULL, 0) == OC_STACK_OK) {
- ret = 0;
- printf("OCDoResource() is succeeded\n");
- } else {
- ret = -1;
- printf("OCDoResource() is failed\n");
- }
-
- return ret;
-}
-
-bool _compare_resource_interface(char *from, char *iface)
-{
- char *str = g_strdup(from);
- char *ptr = strtok(str, ";");
-
- if(ptr == NULL) {
- return false;
- }
-
- do {
- if(strstr(ptr, ".if.")) {
- char *if_ptr = NULL;
- if_ptr = strtok(ptr, "=");
- if_ptr = strtok(NULL, "=");
-
- if(!g_strcmp0(if_ptr, iface)) {
- return true;
- }
- }
- } while ((ptr = strtok(NULL, ";")));
-
- return false;
-}
-
-
-OCEntityHandlerResult _check_request_payload(OCEntityHandlerRequest *ehRequest)
-{
- if( !(ehRequest->query) || \
- (ehRequest->query && (g_strcmp0(ehRequest->query, "") && \
- !_compare_resource_interface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))))
- {
- printf("Not supported Interface\n");
- return OC_EH_BAD_REQ;
- }
-
- return OC_EH_OK;
-}
-
-
-OCRepPayload * _construct_response_of_device(OCEntityHandlerRequest *ehRequest)
-{
- OCRepPayload* input = (OCRepPayload*)(ehRequest->payload);
-
- if (OC_REST_PUT == ehRequest->method || OC_REST_POST == ehRequest->method) {
- /* Get pointer to query */
- bool power;
- if (OCRepPayloadGetPropBool(input, "value", &power)) {
- switch_power = power;
- printf("Client Set Power : %d\n", power);
- }
- }
-
- OCRepPayload *payload = OCRepPayloadCreate();
-
- if (!payload) {
- printf("Failed to allocate Payload\n");
- return NULL;
- }
-
- printf("Client Set payload Power : %d\n", switch_power);
- OCRepPayloadSetPropBool(payload, "value", switch_power);
-
- return payload;
-}
-
-static OCEntityHandlerResult _handle_get_request(OCEntityHandlerRequest *ehRequest, OCRepPayload **payload)
-{
- OCEntityHandlerResult ehResult = OC_EH_ERROR;
- if (!ehRequest) {
- printf("Request is Null\n");
- return ehResult;
- }
-
- if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) {
- printf("Incoming payload not a representation\n");
- return ehResult;
- }
-
- OCRepPayload *getResp = NULL;
- *payload = NULL;
-
- if(ehRequest->resource == res_handle[0]) {
- if(_check_request_payload(ehRequest) != OC_EH_OK) {
- printf("Not supported Interface\n");
- return OC_EH_BAD_REQ;
- } else {
- getResp = _construct_response_of_device(ehRequest);
- }
- }
-
- if (!getResp) {
- printf("constructResponse failed\n");
- return OC_EH_ERROR;
- }
-
- *payload = getResp;
-
- ehResult = OC_EH_OK;
-
- return ehResult;
-}
-
-
-static OCEntityHandlerResult _handle_post_request(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload)
-{
- printf("ProcessPostRequest enter\n");
- OCEntityHandlerResult ehResult = OC_EH_ERROR;
- if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) {
- printf("Incoming payload not a representation\n");
- return ehResult;
- }
-
- OCRepPayload *getResp = NULL;
- *payload = NULL;
-
- if(ehRequest->resource == res_handle[0]) {
- if(_check_request_payload(ehRequest) != OC_EH_OK) {
- printf("Not supported Interface\n");
- return OC_EH_BAD_REQ;
- } else {
- getResp = _construct_response_of_device(ehRequest);
- }
- }
-
- if (!getResp) {
- printf("constructResponse failed\n");
- return OC_EH_ERROR;
- }
-
- *payload = getResp;
-
- ehResult = OC_EH_OK;
-
- return ehResult;
-}
-
-
-OCEntityHandlerResult _handle_oc_entity(OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest,
- void *callbackParam)
-{
- printf("_handle_oc_entity\n");
- OCEntityHandlerResult ehRet = OC_EH_OK;
- OCEntityHandlerResponse response = { 0, 0, OC_EH_ERROR, 0, 0, \
- { }, { 0 }, false };
- OCRepPayload* payload = NULL;
-
- if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) {
- if (OC_REST_GET == entityHandlerRequest->method) {
- printf("Received OC_REST_GET request\n");
- ehRet = _handle_get_request(entityHandlerRequest, &payload);
- } else if (OC_REST_PUT == entityHandlerRequest->method) {
- printf("Received OC_REST_PUT request, from client\n");
- ehRet = _handle_post_request(entityHandlerRequest, &payload);
- } else if (OC_REST_POST == entityHandlerRequest->method) {
- printf("Received OC_REST_POST from client\n");
- ehRet = _handle_post_request(entityHandlerRequest, &payload);
- } else {
- //OC_REST_DISCOVER, OC_REST_PRESENCE, OC_REST_OBSERVE_ALL, OC_REST_OBSERVE, OC_REST_DELETE, OC_REST_NOMETHOD
- printf("Received unsupported method %d from client\n", entityHandlerRequest->method);
- ehRet = OC_EH_ERROR;
- }
- if (!((ehRet == OC_EH_ERROR) || (ehRet == OC_EH_FORBIDDEN))) {
- response.requestHandle = entityHandlerRequest->requestHandle;
- response.resourceHandle = entityHandlerRequest->resource;
- response.ehResult = ehRet;
- response.payload = (OCPayload*)payload;
- response.persistentBufferFlag = 0;
-
- response.numSendVendorSpecificHeaderOptions = 0;
- memset(response.sendVendorSpecificHeaderOptions, 0,
- sizeof(response.sendVendorSpecificHeaderOptions));
- memset(response.resourceUri, 0, sizeof(response.resourceUri));
-
- // Send the response
- if (OCDoResponse(&response) != OC_STACK_OK) {
- printf("Error sending response\n");
- ehRet = OC_EH_ERROR;
- }
-
- if (OC_REST_POST == entityHandlerRequest->method || OC_REST_PUT == entityHandlerRequest->method) {
- if (OCNotifyAllObservers(res_handle[0], OC_NA_QOS) != OC_STACK_OK) {
- printf("Fail to OCNotifyAllObservers()\n");
- ehRet = OC_EH_ERROR;
- }
- }
- }
- }
-
- if (entityHandlerRequest && (flag & OC_OBSERVE_FLAG)) {
- printf("Flag includes OC_OBSERVE_FLAG\n");
- if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action) {
- printf("Received OC_OBSERVE_REGISTER from client\n");
- } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action) {
- printf("Received OC_OBSERVE_DEREGISTER from client\n");
- }
- }
-
- OCPayloadDestroy(response.payload);
- return ehRet;
-}
-
-
-OCStackApplicationResult _handle_rd_publish_callback(void *ctx, OCDoHandle handle,
- OCClientResponse *clientResponse)
-{
- /* Debug */
- if (clientResponse) {
- printf("RD resource response received, code: [%d]\n", clientResponse->result);
- printf("############## Publish resource response received [%s]\n", clientResponse->resourceUri);
- }
-
-// _cond_signal();
-
- return OC_STACK_KEEP_TRANSACTION;
-}
-
-
-OCStackApplicationResult _handle_rd_delete_callback(void *ctx, OCDoHandle handle,
- OCClientResponse *clientResponse)
-{
- /* Debug */
- if (clientResponse) {
- printf("RD resource response received, code: %d\n", clientResponse->result);
- printf("############## Publish resource response received [%s]\n", clientResponse->resourceUri);
- }
-
-// _cond_signal();
-
- return OC_STACK_KEEP_TRANSACTION;
-}
-
-
-void* _oc_process_thd(void * ptr)
-{
- (void) ptr;
- while (!isExit) {
- if (OCProcess() != OC_STACK_OK) {
- printf("OCStack process error\n");
- return NULL;
- }
- sleep(1);
- }
-
- return NULL;
-}
-
-
-int _init_oc_stack()
-{
- ps = (OCPersistentStorage *)calloc(1, sizeof(OCPersistentStorage));
- if (!ps) return -1;
-
- ps->open = _client_open;
- ps->read = fread;
- ps->write = fwrite;
- ps->close = fclose;
- ps->unlink = unlink;
-
- if (OCRegisterPersistentStorageHandler(ps) == OC_STACK_OK) {
- printf("OCRegisterPersistentStorageHandler() succeeded\n");
- } else {
- printf("OCRegisterPersistentStorageHandler() failed\n");
- return -1;
- }
-
- if (OCInit(NULL, 0, OC_SERVER) == OC_STACK_OK) {
- printf("OCInit() succeeded\n");
- } else {
- printf("OCInit() failed\n");
- return -1;
- }
-
-#ifdef _USE_WWST_
- if (OCInitPM(OC_SECURITY_SQL_DB_FILE_NAME) == OC_STACK_OK) {
- printf("OCInitPM() is succeeded!\n");
- } else {
- printf("OCInitPM() is failed");
- return -1;
- }
-#endif
- _set_platform_info();
-
- _set_device_info();
-
- return 0;
-}
-
-
-int _init_default_test_res()
-{
-#if 0
- OCUUIdentity deviceId;
- if (OCGetDeviceId(&deviceId) == OC_STACK_OK) {
- printf("OCGetDeviceId() is succeeded\n");
- } else {
- printf("OCGetDeviceId() is failed\n");
- return -1;
- }
-#endif
-
- /* Create air conditioner resource handle */
- if (OCCreateResource(&res_handle[0],
-#ifdef _USE_WWST_
- "oic.r.switch.binary",
- "oic.if.baseline",
- "/capability/switch/0",
- _handle_oc_entity, NULL,
- OC_DISCOVERABLE|OC_OBSERVABLE) != OC_STACK_OK) {
-#else
- "x.com.samsung.da.device",
- OC_RSRVD_INTERFACE_DEFAULT,
- "/sec/aircon/0",
- _handle_oc_entity, NULL,
- OC_DISCOVERABLE) != OC_STACK_OK) {
-#endif
- printf("OCCreateResource() failed\n");
- return -1;
- }
-
-/* oic.if.b, oic.if.ll */
-/*
- if (OCBindResourceInterfaceToResource(res_handle[0], OC_RSRVD_INTERFACE_BATCH) != OC_STACK_OK) {
- printf("OCBindResourceInterfaceToResource() [%s] failed\n", OC_RSRVD_INTERFACE_BATCH);
- }
-
- if (OCBindResourceInterfaceToResource(res_handle[0], OC_RSRVD_INTERFACE_LL) != OC_STACK_OK) {
- printf("OCBindResourceInterfaceToResource() [%s] failed\n", OC_RSRVD_INTERFACE_LL);
- }
-*/
-
-// if (OCBindResource(aircon_handle, binary_switch_handle) != OC_STACK_OK) {
-// printf("OCBindResource() failed\n");
-// return -1;
-// }
-
- return 0;
-}
-
-
-int _create_fw_res()
-{
- fmwup_create_firmware_resource(&res_handle[1]);
-
-// if (OCBindResource(aircon_handle, firmware_handle) != OC_STACK_OK) {
-// printf("OCBindResource() failed\n");
-// return -1;
-// }
-
- return 0;
-}
-
-
-int _publish_fw_res_to_rd()
-{
- OCCallbackData cb_data = {NULL, NULL, NULL};
- cb_data.cb = _handle_rd_publish_callback;
- cb_data.context = (void *)DEFAULT_CONTEXT_VALUE;
-
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s", CLOUD_PROTOCOL, CLOUD_STG_SERVER);
-
-#ifdef _USE_WWST_
-// if (OCRDPublish(NULL, uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
-// NULL, 0,
-// &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
-// printf("OCRDPublish() failed\n");
-// return -1;
-// }
-//
-//// _lock_and_wait();
-//
-// if (OCRDPublish(NULL, uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
-// res_handle, 2,
-// &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
-// printf("OCRDPublish() failed\n");
-// return -1;
-// }
-
- int ocResult = OC_STACK_OK;
- ocResult = OCRDPublish(NULL, uri, (CT_ADAPTER_TCP | CT_IP_USE_V4), NULL, 0, &cb_data, OC_LOW_QOS);
- if (ocResult != OC_STACK_OK) {
- printf("Publish Resource with null handle failed");
- return -1;
- }
-
- ocResult = OCRDPublish(NULL, uri, (CT_ADAPTER_TCP | CT_IP_USE_V4), &res_handle[0], 1, &cb_data, OC_LOW_QOS);
- if (ocResult != OC_STACK_OK) {
- printf("Publish Resource failed [%d]", ocResult);
- return -1;
- }
-
- ocResult = OCRDPublish(NULL, uri, (CT_ADAPTER_TCP | CT_IP_USE_V4), &res_handle[1], 1, &cb_data, OC_LOW_QOS);
- if (ocResult != OC_STACK_OK) {
- printf("Publish firmware Resource failed [%d]", ocResult);
- return -1;
- }
-
-
-#else
- if (OCRDPublish(uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
- NULL, 0,
- &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
- printf("OCRDPublish() failed\n");
- return -1;
- }
-
-// _lock_and_wait();
-
- if (OCRDPublish(uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
- res_handle, 2,
- &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
- printf("OCRDPublish() failed\n");
- return -1;
- }
-#endif
-
-// _lock_and_wait();
-
- fmwup_check_firmware_upgraded();
-
- return 0;
-}
-
-
-int _delete_fw_res_from_rd()
-{
- OCCallbackData cb_data = {NULL, NULL, NULL};
- cb_data.cb = _handle_rd_delete_callback;
- cb_data.context = (void *)DEFAULT_CONTEXT_VALUE;
-
- char uri[MAX_URI_LENGTH] = { 0 };
- snprintf(uri, MAX_URI_LENGTH, "%s%s", CLOUD_PROTOCOL, CLOUD_STG_SERVER);
-
-#ifdef _USE_WWST_
- if (OCRDDelete(NULL, uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
- res_handle, 2,
- &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
- printf("OCRDDelete() failed\n");
- return -1;
- }
-#else
- if (OCRDDelete(uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
- res_handle, 2,
- &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
- printf("OCRDDelete() failed\n");
- return -1;
- }
-#endif
-
-// _lock_and_wait();
-
- return 0;
-}
-
-
-int _destory_fw_res()
-{
- if (fmwup_destory_firmware_resource(&res_handle[1]) != FMWUP_SUCCESS) {
- return -1;
- }
-
- return 0;
-}
-
-
-int _destory_default_res()
-{
- if (OCDeleteResource(res_handle[0]) != OC_STACK_OK) {
- printf("OCDeleteResource() failed for aircon_handle\n");
- return -1;
- }
-
- return 0;
-}
-
-
-static void _state_changed_cb(fmwup_state_e value, bool is_new_firmware)
-{
- printf("state_changed_cb state[%d], is_new_firmware[%d]\n", value, is_new_firmware);
-}
-
-
-int _set_state_changed_cb()
-{
- printf("_set_state_changed_cb\n");
- if (fmwup_set_state_changed_cb(_state_changed_cb) != FMWUP_SUCCESS)
- return -1;
-
- return 0;
-}
-
-
-int _unset_state_changed_cb()
-{
- fmwup_unset_state_changed_cb();
- return 0;
-}
-
-
-int _set_active_check()
-{
- if (fmwup_get_newest_firmware_from_server() != FMWUP_SUCCESS)
- return -1;
-
- return 0;
-}
-
-
-int _get_fw_res_value()
-{
- char *temp_value = NULL;
- if (fmwup_get_firmware_resource_value(FMWUP_RES_UPDATE_STATE, &temp_value) != FMWUP_SUCCESS) {
- return -1;
- } else {
- printf("RES_UPDATE_STATE [%s]\n", temp_value);
- g_free(temp_value);
- }
-
- if (fmwup_get_firmware_resource_value(FMWUP_RES_UPDATE_RESULT, &temp_value) != FMWUP_SUCCESS) {
- return -1;
- } else {
- printf("RES_UPDATE_RESULT [%s]\n", temp_value);
- g_free(temp_value);
- }
-
- if (fmwup_get_firmware_resource_value(FMWUP_RES_CURRENT_VERSION, &temp_value) != FMWUP_SUCCESS) {
- return -1;
- } else {
- printf("RES_CURRENT_VERSION [%s]\n", temp_value);
- g_free(temp_value);
- }
-
- if (fmwup_get_firmware_resource_value(FMWUP_RES_NEW_VERSION, &temp_value) != FMWUP_SUCCESS) {
- return -1;
- } else {
- printf("RES_NEW_VERSION [%s]\n", temp_value);
- g_free(temp_value);
- }
-
- return 0;
-}
-
-void _show_menu()
-{
- printf("============================================\n");
- printf("=== Controlee firmware resource test app ===\n");
- printf("============================================\n");
- printf(" [A] Create Resource & Sign Up/In & publish\n");
- printf(" [C] Sign Up/In\n");
- printf(" [D] Sign Out\n");
- printf(" [E] Set Active check\n");
- printf(" [1] Create default resource\n");
- printf(" [2] Create firmware resource\n");
- printf(" [3] Publish resources to RD\n");
- printf(" [4] Delete resources from RD\n");
- printf(" [5] Destroy firmware resource\n");
- printf(" [6] Destroy default resource\n");
- printf(" [7] Set state changed callback\n");
- printf(" [8] Unset state changed callback\n");
- printf(" [9] Get firmware resource value\n");
- printf(" [0] Exit\n");
- printf("============================================\n");
- printf("Input test menu : \n");
-}
-
-#define _G_IO_WATCH_
-
-#ifdef _G_IO_WATCH_
-gboolean _main_thread(GIOChannel *channel, GIOCondition condition, gpointer data)
-#else
-void* _main_thread(void *data)
-#endif
-{
-#ifdef _G_IO_WATCH_
- if (condition != G_IO_IN)
- return false;
-
- int rv = 0;
- gsize length;
- gchar *str_ret;
-
- g_io_channel_read_line(channel, &str_ret, &length, NULL, NULL);
- if (!str_ret)
- return false;
-#else
- (void)data;
- int rv = 0;
- char str_ret[10];
-
- while (true) {
- memset(str_ret, 0x00, sizeof(str_ret));
-
- scanf("%s", str_ret);
-
-#endif
-
- if (str_ret[0] == '\n' || str_ret[0] == '\r') {
- _show_menu();
- } else {
- switch (str_ret[0]) {
- case 'A' :
- case 'a' :
- rv += _set_state_changed_cb();;
- rv += _init_default_test_res();
- rv += _create_fw_res();
- g_auto_publish = true;
- rv += _signup();
- break;
- case 'C' :
- case 'c' :
- g_auto_publish = false;
- rv = _signup();
- break;
- case 'D' :
- case 'd' :
- rv = _signout();
- break;
- case 'E' :
- case 'e' :
- rv = _set_active_check();
- break;
- case '1':
- rv = _init_default_test_res();
- break;
- case '2':
- rv = _create_fw_res();
- break;
- case '3':
- rv = _publish_fw_res_to_rd();
- break;
- case '4':
- rv = _delete_fw_res_from_rd();
- break;
- case '5':
- rv = _destory_fw_res();
- break;
- case '6':
- rv = _destory_default_res();
- break;
- case '7':
- rv = _set_state_changed_cb();
- break;
- case '8':
- rv = _unset_state_changed_cb();
- break;
- case '9':
- rv = _get_fw_res_value();
- break;
- case '0' :
- printf("Exit from test app!\n");
- exit(0);
- break;
- default :
- break;
- }
-
- if (rv == 0)
- printf("[%c]operation succeeded!\n", str_ret[0]);
- else
- printf("[%c]operation failed!\n", str_ret[0]);
-
- printf("\n*** Press 'enter' to show menu *** \n");
- }
-
-#ifdef _G_IO_WATCH_
- g_free(str_ret);
- return true;
-#else
-
- }
-
- return NULL;
-#endif
-}
-
-
-int main(int argc, char *argv[])
-{
- GMainLoop *mainloop;
-
-#if !GLIB_CHECK_VERSION(2, 36, 0)
- g_type_init();
-#endif
-
- bSignin = false;
- isExit = false;
- ps = NULL;
- switch_power = true;
-
- mainloop = g_main_loop_new(NULL, false);
-
- if (_init_oc_stack() != 0) {
- printf("Fail to _init_oc_stack()\n");
- return -1;
- }
-
- pthread_t oc_proc_thd;
- pthread_create(&oc_proc_thd, NULL, _oc_process_thd, NULL);
-
- _show_menu();
-
-#ifdef _G_IO_WATCH_
- GIOChannel *channel = g_io_channel_unix_new(0);
- g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), _main_thread, NULL);
-#else
- pthread_t test_thd;
- pthread_create(&test_thd, NULL, _main_thread, NULL);
-#endif
-
- g_main_loop_run(mainloop);
-
- if (ps)
- free(ps);
-
- return 0;
-}
+++ /dev/null
-const PORT = 8080;
-const HTTP_OK = 200;
-const HTTP_BAD_REQUEST = 400;
-const HTTP_INTERNAL_ERROR = 500;
-
-var express = require('express');
-var bodyParser = require('body-parser');
-var app = express();
-
-//app.use(express.static('public'));
-//app.use(bodyParser.urlencoded({ extended: false }));
-app.use(bodyParser.json());
-var jsonParser = bodyParser.json();
-
-
-var sqlite3 = require('sqlite3').verbose();
-var db = new sqlite3.Database('auth_info.db');
-
-db.serialize(function() {
- db.run("CREATE TABLE IF NOT EXISTS auth_tbl (id TEXT primary key, email TEXT, code TEXT)");
- db.each("SELECT * FROM auth_tbl", function(err, row) {
- console.log(row);
- });
-});
-
-// this enables desktop to accept redirect_uri from browser
-var server = app.listen(PORT, function () {
- var port = server.address().port;
- console.log("OAuth broker listening at http://127.0.0.1:%s", port)
-});
-
-function updateCb(err, res) {
- if (err) {
- console.error("error", err);
- res.status(HTTP_INTERNAL_ERROR).json(err);
- }
- else {
- console.log("update completed");
- res.sendStatus(200);
- }
-
-}
-
-function insertCb(err, res) {
- if (err){
- console.error("error", err);
- res.status(HTTP_INTERNAL_ERROR).json(err);
- }
- else {
- console.log("insert completed");
- res.sendStatus(200);
- }
-}
-
-app.post('/auth_response', jsonParser, function(req, res) {
- var code = req.body.code;
- var id = req.body.id;
-
- console.log("auth code: [", code, "]");
- console.log("id: [", id, "]");
-
-
- /* DB write */
- db.get("SELECT * FROM auth_tbl WHERE id=?", id, function(err, row) {
- if(err) {
- console.error("error", err);
- res.status(HTTP_INTERNAL_ERROR).json(err);
- }
- else if(row) {
- db.run("UPDATE auth_tbl SET code=? WHERE id=?", code, id,
- function(err) { updateCb(err, res); });
- }
- else {
- db.run("INSERT INTO auth_tbl (id, code) VALUES (?,?)", id, code,
- function(err) { insertCb(err, res); });
- }
- });
-});
-
-function getAuthCodeCb(err, row, res) {
- console.log(row);
- if (err) {
- console.error("error", err);
- res.status(HTTP_INTERNAL_ERROR).json(err);
- }
- else if (!row) {
- console.log('id not found');
- res.status(HTTP_BAD_REQUEST).json({errmsg:'id not found'});
- }
- else {
- console.log(row);
- res.json({code:row.code});
- }
-}
-
-app.get('/auth_code', function(req, res) {
- var id = req.query.id;
-
- /* DB read */
- var query = "SELECT * FROM auth_tbl WHERE id='" + id + "'";
- console.log("query: ("+query+")");
- db.get(query, function(err,row) { getAuthCodeCb(err, row, res);});
-});
-
-// curl -v -H "Content-Type: application/json" -d '{"id":"abc", "email":"abc@samsung.com"}' -X POST http://10.113.63.216:8080/auth_request
-app.post('/auth_request', jsonParser, function(req, res) {
- var id = req.body.id; // id is generated by device
- var email = req.body.email;
-
- console.log("id: [", id, "]");
- console.log("email: [", email, "]"); // this field is used for confirmation about auth
-
- /* DB write */
- db.get("SELECT * FROM auth_tbl WHERE id=?", id, function(err, row) {
- if(err) {
- console.error("error", err);
- res.status(HTTP_INTERNAL_ERROR).json(err);
- }
- else if(row) {
- db.run("UPDATE auth_tbl SET email=? WHERE id=?", email, id,
- function(err) { updateCb(err, res); });
- }
- else {
- db.run("INSERT INTO auth_tbl (id, email) VALUES (?,?)", id, email,
- function(err) { insertCb(err, res); });
- }
- });
-});
-
+++ /dev/null
-{
- "name": "oauth-broker",
- "version": "0.0.1",
- "main": "oauth_broker.js",
- "dependencies": {
- "express": "4.14.x",
- "body-parser": "1.16.x",
- "sqlite3": "~3.1.4"
- }
-}
+++ /dev/null
-const OAUTH_BROKER_ADDR = "127.0.0.1";
-const OAUTH_BOKRER_PORT = "8080";
-
-const PORT = 8000;
-const REQ_ID = "0101231234";
-
-const HTTP_OK = 200;
-const HTTP_BAD_REQUEST = 400;
-const HTTP_INTERNAL_ERROR = 500;
-
-var express = require('express');
-var app = express();
-var bodyParser = require('body-parser');
-var request = require('request');
-
-app.use(express.static('public'));
-app.use(bodyParser.urlencoded({ extended: false }));
-
-// this enables desktop to accept redirect_uri from browser
-var server = app.listen(PORT, function () {
- var port = server.address().port;
- console.log("OAuth redirect_uri handler listening at http://127.0.0.1:%s", port)
-})
-
-app.get('/oauth_callback', function(req, res) {
- console.log("auth code: [", req.query.code, "]");
- var http = require('http');
-
- var jsonBody={};
- jsonBody.id = REQ_ID;
- jsonBody.code = req.query.code;
-
- console.log("jsonBody:", jsonBody);
-
- var postHeaders = {
- 'Content-Type' : 'application/json',
- 'Content-Length' : Buffer.byteLength(JSON.stringify(jsonBody), 'utf8')
- };
-
-// uncomment when query is used instead,
-/*
- var query = "id=" + REQ_ID + "&" + "code="+req.query.code;
- var options = {
- host: '127.0.0.1',
- port: '8080',
- path: '/auth_response?' + query,
- method: 'POST' ,
- headers : postHeaders
- };
-*/
- var options = {
- host: OAUTH_BROKER_ADDR,
- port: OAUTH_BOKRER_PORT,
- path: '/auth_response',
- method: 'POST' ,
- headers : postHeaders
- };
-
- console.info(options);
-
- var http_req = http.request(options, function(res) {
- console.log('STATUS:' + res.statusCode);
- //console.log('HEADERS:' + JSON.stringify(res.headers));
- res.setEncoding('utf8');
- res.on('data', function (chunk) {
- console.log('BODY: ' + chunk);
- });
- });
- http_req.write(JSON.stringify(jsonBody)); //'{"id":"12334", "code":req.query.code}');
- http_req.end();
- http_req.on('error', function(e) {
- console.error(e);
- });
-
- var html = "<!DOCTYPE html>\n<html>\n <head>\n </head>\n <body>\n <h1>CODE [" + req.query.code +"]</h1>\n </body>\n</html>";
- res.send(html);
-})
+++ /dev/null
-{
- "name": "oauth-broker-client",
- "version": "0.0.1",
- "main": "oauth_redirect_uri_handler.js",
- "dependencies": {
- "express": "4.14.x",
- "body-parser": "1.16.x",
- "request" : "2.81.x"
- }
-}
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<body>
-<p>Click the button to send req_auth to GITHUB.</p>
-
-<button onclick="reqAuthToGithub()">GITHUB</button>
-<!-- this page acts as client app in mobile phone, and will be replaced -->
-<script>
-function reqAuthToGithub() {
- window.open("https://github.com/login/oauth/authorize?client_id=e6bd5594e38b7f268af1&redirect_uri=http://127.0.0.1:8000/oauth_callback");
-
-}
-</script>
-
-</body>
-</html>
-
-