[PROTO] add MSG_GET_SCREENSHOT support
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 6 Nov 2013 08:17:15 +0000 (12:17 +0400)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 7 Nov 2013 05:15:07 +0000 (05:15 +0000)
Change-Id: I3fe6ac0a3a9a4e587d49d7f98dd5bcad752987c2
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
helper/dacapture.c
helper/libdaprobe.c
include/probeinfo.h

index 6e367ad..6d25d4c 100755 (executable)
  */
 
 #include <stdlib.h>            // for system
-#include <sys/types.h> // for stat, getpid
-#include <sys/stat.h>  // fot stat, chmod
+#include <sys/types.h>         // for stat, getpid
+#include <sys/stat.h>          // fot stat, chmod
 #include <unistd.h>            // fot stat, getpid
-#include <sys/shm.h>   // for shmget, shmat
+#include <sys/shm.h>           // for shmget, shmat
+#include <pthread.h>           // for mutex
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -314,6 +315,9 @@ int captureScreen()
        screenshot_data sdata;
        probeInfo_t     probeInfo;
        int ret = 0;
+       static pthread_mutex_t captureScreenLock = PTHREAD_MUTEX_INITIALIZER;
+
+       pthread_mutex_lock(&captureScreenLock);
 
        probeBlockStart();
 
@@ -387,6 +391,7 @@ int captureScreen()
 
        probeBlockEnd();
 
+       pthread_mutex_unlock(&captureScreenLock);
        return ret;
 }
 
index 8ed1dfb..7ce4094 100755 (executable)
@@ -273,8 +273,9 @@ static void *recvThread(void __unused * data)
 
                                log.data[log.length] = '\0';
 
-                               if(log.type == MSG_CONFIG)
-                               {
+                               if (log.type == MSG_CAPTURE_SCREEN) {
+                                       captureScreen();
+                               } else if (log.type == MSG_CONFIG) {
                                        _configure(log.data);
                                }
                                else if(log.type == MSG_STOP)
index 467ac9e..89365dc 100755 (executable)
@@ -177,7 +177,8 @@ enum MessageType
        MSG_ALLOC = 10,
        MSG_ERROR = 11,
        MSG_STOP = 101,
-       MSG_CONFIG = 103
+       MSG_CONFIG = 103,
+       MSG_CAPTURE_SCREEN= 108
 };
 
 enum DaOptions