Exemplo n.º 1
0
 public byte[] GetScreenshotAndWait()
 {
     byte[] output_buffer = null;
     GetScreenshot((byte[] end_data) =>
     {
         //Reset the active image and return the output buffer.
         active_receive_img = null;
         output_buffer      = end_data;
     });
     //Wait
     while (output_buffer == null)
     {
         ;
     }
     //Return now.
     return(output_buffer);
 }
Exemplo n.º 2
0
 public void GetScreenshot(OnImageDone callback)
 {
     //Screenshots are sent in chunks. The first chunk has a header of 12 bytes.
     SendEndpointMsg(PebbleEndpointType.SCREENSHOT, new byte[] { 0x00 }, (PebbleProtocolMessage msg) =>
     {
         //Use the object instead. Create one if it doesn't exist.
         if (active_receive_img == null)
         {
             active_receive_img = new PebbleChunkedScreenshot((byte[] data) =>
             {
                 //Clear active screenshot and then call callback.
                 active_receive_img = null;
                 callback(data);
             });
         }
         return(active_receive_img.OnGotData(msg));
     });
 }