modify for sound level demo on hands-on lab 01/157001/1
authorJeonghoon Park <jh1979.park@samsung.com>
Mon, 23 Oct 2017 06:03:47 +0000 (15:03 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Mon, 23 Oct 2017 06:03:47 +0000 (15:03 +0900)
Change-Id: I9e0bcc04a01e6ed1fa4bccf67b1c8b7d1367a579

src/controller.c
src/controller_internal.c
tizen-manifest.xml.in

index c80090e..90c0e2a 100644 (file)
 #include "webutil.h"
 
 #define CONNECTIVITY_KEY "opened"
-#define SENSORING_TIME_INTERVAL 1.0f
+#define SENSORING_TIME_INTERVAL 0.01f
 
 typedef struct app_data_s {
        Ecore_Timer *getter_timer;
        connectivity_resource_s *resource_info;
 } app_data;
 
+const char bar[][128] = {
+       ")",
+       "))",
+       ")))",
+       "))))",
+       ")))))",
+       "))))))",
+       ")))))))",
+       "))))))))",
+       ")))))))))",
+       "))))))))))",
+       ")))))))))))",
+       "))))))))))))",
+       ")))))))))))))",
+       "))))))))))))))",
+       ")))))))))))))))",
+       "))))))))))))))))",
+       ")))))))))))))))))",
+       "))))))))))))))))))",
+       ")))))))))))))))))))",
+       "))))))))))))))))))))",
+       ")))))))))))))))))))))",
+       "))))))))))))))))))))))",
+       ")))))))))))))))))))))))",
+       "))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))",
+       "))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))"
+};
+
 static Eina_Bool control_sensors_cb(void *data)
 {
-       app_data *ad = data;
+       unsigned int sl_value = 0;
+       unsigned int index = 0;
+
+       if (resource_read_sound_level_sensor(0, &sl_value) == -1)
+               _E("failed to resource_read_sound_level_sensor()");
 
-       if (connectivity_notify_bool(ad->resource_info, CONNECTIVITY_KEY, true) == -1)
-               _E("Cannot notify message");
+       index = sl_value/8;
+       _D("value : %4u   %s", sl_value, bar[index]);
 
        return ECORE_CALLBACK_RENEW;
 }
@@ -62,12 +197,6 @@ static bool service_app_create(void *data)
        controller_init_internal_functions();
 
        /**
-        * Create a connectivity resource and registers the resource in server.
-        */
-       ret = connectivity_set_resource(NULL, "org.tizen.door", &ad->resource_info);
-       if (ret == -1) _E("Cannot broadcast resource");
-
-       /**
         * Creates a timer to call the given function in the given period of time.
         * In the control_sensors_cb(), each sensor reads the measured value or writes a specific value to the sensor.
         */
@@ -87,12 +216,6 @@ static void service_app_terminate(void *data)
        if (ad->getter_timer)
                ecore_timer_del(ad->getter_timer);
 
-
-       /**
-        * Releases the resource about connectivity.
-        */
-       connectivity_unset_resource(ad->resource_info);
-
        /**
         * No modification required!!!
         * Access only when modifying internal functions.
index 28002f7..5aa0135 100644 (file)
 
 void controller_init_internal_functions(void)
 {
-       connectivity_init();
+
 }
 
 void controller_fini_internal_functions(void)
 {
        _I("Terminating...");
        resource_close_all();
-       connectivity_fini();
        controller_util_free();
 }
index 677801e..1117525 100644 (file)
@@ -12,5 +12,6 @@
     <privileges>
         <privilege>http://tizen.org/privilege/network.get</privilege>
                <privilege>http://tizen.org/privilege/internet</privilege>
+               <privilege>http://tizen.org/privilege/peripheralio</privilege>
     </privileges>
 </manifest>