@@ -0,0 +1,1593 @@
+import os%0A#from pathlib import Path%0A#import path%0Aimport picamera%0Afrom time import sleep%0Afrom threading import Thread%0A%0Adef takePictureGlobal(picturetaken_callback, peripheral_id):%0A    camera = picamera.PiCamera()%0A    try:%0A      camera.sharpness = 0%0A      camera.contrast = 0%0A      camera.brightness = 70%0A      camera.saturation = 0%0A      camera.ISO = 0%0A      camera.video_stabilization = False%0A      camera.exposure_compensation = 0%0A      camera.exposure_mode = 'off'%0A      camera.meter_mode = 'average'%0A      camera.awb_mode = 'auto'%0A      camera.image_effect = 'none'%0A      camera.color_effects = None%0A      camera.rotation = 90%0A      camera.hflip = False%0A      camera.vflip = False%0A      camera.crop = (0.0, 0.0, 1.0, 1.0)%0A      camera.resolution = %22HD%22%0A%0A      PICTURE_PATH = os.path.expanduser(%22../../akpics%22)%0A%0A      if not os.path.exists(PICTURE_PATH):%0A        os.makedirs(PICTURE_PATH)%0A%0A      if os.path.exists(PICTURE_PATH):%0A        print('capturing image')%0A        picturefile = PICTURE_PATH+ '/img' + '.jpg';%0A        camera.capture(picturefile)%0A        sleep(3);%0A        if not (picturetaken_callback is None):%0A          picturetaken_callback(picturefile, peripheral_id);%09 %0A      else:%0A        print(%22picture path does  not exist%22);%0A    finally:%0A      camera.close();%0A%0Aclass AKCamera:%0A  def takeOnePicture(self, picturetaken_callback, peripheral_id):%0A    thread = Thread(target = takePictureGlobal, args = (picturetaken_callback, peripheral_id, ))%0A    thread.start()%0A    #thread.join()%0A    #print %22thread finished...exiting%22%0A%0A%0A%0Atp = AKCamera();%0Atp.takeOnePicture(None, None)%0Atp = None;

Add support of event and camera