summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2017-11-10 08:14:34 -0800
committerNick Van Doorn <vandoorn.nick@gmail.com>2017-11-10 08:17:14 -0800
commitc38dc2555b4aa345df14a40ecd35112d91fc75c9 (patch)
tree530c7cedf88abead2afe9ae88f832f39fec6147e
parent76a4d840c3fc51f2fb415d299f16f54028f6cb22 (diff)
Set methods as shared and lower timeout
Thanks to @dpfrey for the excellent support resolving our build issues related to this file
-rw-r--r--camera.h65
1 files changed, 32 insertions, 33 deletions
diff --git a/camera.h b/camera.h
index 8d342d7..7c6c46b 100644
--- a/camera.h
+++ b/camera.h
@@ -1,5 +1,3 @@
-#include "legato.h"
-
#define VC0706_RESP_PREFIX 0x76
#define VC0706_PREFIX 0x56
#define VC0706_RESET 0x26
@@ -36,10 +34,9 @@
#define VC0706_SET_ZOOM 0x52
#define VC0706_GET_ZOOM 0x53
-#define CAM_BAUD_RATE LE_TTY_SPEED_38400
#define BUFF_SIZE 100
#define DELAY 10
-#define TIMEOUT 200
+#define TIMEOUT 20
#define CAM_SERIAL 0
static const char SERIAL_PATH[] = "/dev/ttyHS0";
@@ -53,32 +50,34 @@ typedef struct {
} Camera;
void delay (unsigned int msecs);
-int openCameraFd ();
-void sendCommand (Camera *cam, uint8_t cmd, uint8_t args[]);
-bool runCommand (Camera *cam, uint8_t cmd, uint8_t args[], int respLen);
-uint8_t readResponse (Camera *cam, unsigned int nBytes, unsigned int timeout);
-bool verifyResponse (Camera *cam, uint8_t cmd);
-bool cameraFrameBuffCtrl (Camera *cam, uint8_t cmd);
-bool takePicture (Camera *cam);
-bool reset (Camera *cam);
-bool TVon (Camera *cam);
-bool TVOff (Camera *cam);
-uint8_t *readPicture (Camera *cam, uint8_t n);
-bool resumeVideo (Camera *cam);
-uint32_t frameLength (Camera *cam);
-char *getVersion (Camera *cam);
-uint8_t available (Camera *cam);
-uint8_t getDownsize (Camera *cam);
-bool setDownsize(Camera *cam, uint8_t newSize);
-uint8_t getImageSize (Camera *cam);
-bool setImageSize (Camera *cam, uint8_t x);
-bool getMotionDetect (Camera *cam);
-uint8_t getMotionStatus(Camera *cam, uint8_t x);
-bool motionDetected (Camera *cam);
-bool setMotionDetect (Camera *cam, bool flag);
-bool setMotionStatus (Camera *cam, uint8_t x, uint8_t d1, uint8_t d2);
-uint8_t getCompression (Camera *cam);
-bool setCompression(Camera *cam, uint8_t c);
-bool getPTZ(Camera *cam, uint16_t *w, uint16_t *h, uint16_t *wz, uint16_t *hz, uint16_t *pan, uint16_t *tilt);
-bool setPTZ(Camera *cam, uint16_t wz, uint16_t hz, uint16_t pan, uint16_t tilt);
-bool snapshotToFile (Camera *cam, char *path, uint8_t imgSize);
+LE_SHARED int openCameraFd ();
+LE_SHARED void sendCommand (Camera *cam, uint8_t cmd, uint8_t args[]);
+LE_SHARED bool runCommand (Camera *cam, uint8_t cmd, uint8_t args[], int respLen, bool flushFlag);
+LE_SHARED bool runCommandFlush (Camera *cam, uint8_t cmd, uint8_t args[], int respLen);
+LE_SHARED uint8_t readResponse (Camera *cam, unsigned int nBytes, unsigned int timeout);
+LE_SHARED void printBuffer (Camera *cam);
+LE_SHARED bool verifyResponse (Camera *cam, uint8_t cmd);
+LE_SHARED bool cameraFrameBuffCtrl (Camera *cam, uint8_t cmd);
+LE_SHARED bool takePicture (Camera *cam);
+LE_SHARED bool reset (Camera *cam);
+LE_SHARED bool TVon (Camera *cam);
+LE_SHARED bool TVOff (Camera *cam);
+LE_SHARED uint8_t *readPicture (Camera *cam, uint8_t n);
+LE_SHARED bool resumeVideo (Camera *cam);
+LE_SHARED uint32_t frameLength (Camera *cam);
+LE_SHARED char *getVersion (Camera *cam);
+LE_SHARED uint8_t available (Camera *cam);
+LE_SHARED uint8_t getDownsize (Camera *cam);
+LE_SHARED bool setDownsize(Camera *cam, uint8_t newSize);
+LE_SHARED uint8_t getImageSize (Camera *cam);
+LE_SHARED bool setImageSize (Camera *cam, uint8_t x);
+LE_SHARED bool getMotionDetect (Camera *cam);
+LE_SHARED uint8_t getMotionStatus(Camera *cam, uint8_t x);
+LE_SHARED bool motionDetected (Camera *cam);
+LE_SHARED bool setMotionDetect (Camera *cam, bool flag);
+LE_SHARED bool setMotionStatus (Camera *cam, uint8_t x, uint8_t d1, uint8_t d2);
+LE_SHARED uint8_t getCompression (Camera *cam);
+LE_SHARED bool setCompression(Camera *cam, uint8_t c);
+LE_SHARED bool getPTZ(Camera *cam, uint16_t *w, uint16_t *h, uint16_t *wz, uint16_t *hz, uint16_t *pan, uint16_t *tilt);
+LE_SHARED bool setPTZ(Camera *cam, uint16_t wz, uint16_t hz, uint16_t pan, uint16_t tilt);
+LE_SHARED bool snapshotToFile (Camera *cam, char *path, uint8_t imgSize);