summaryrefslogtreecommitdiff
path: root/camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'camera.h')
-rw-r--r--camera.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/camera.h b/camera.h
index e8c02ab..b6831d3 100644
--- a/camera.h
+++ b/camera.h
@@ -2,7 +2,6 @@
#define CAMERA_H
#include "legato.h"
-#include "interfaces.h"
#define VC0706_RESP_PREFIX 0x76
#define VC0706_PREFIX 0x56
@@ -40,7 +39,7 @@
#define VC0706_SET_ZOOM 0x52
#define VC0706_GET_ZOOM 0x53
-#define CAM_BUFF_SIZE 200
+#define CAM_BUFF_SIZE 100
#define CAM_BLOCK_SIZE 32
#define CAM_DELAY 10
#define CAM_SERIAL 0
@@ -56,13 +55,23 @@ typedef struct {
uint16_t frameptr;
} Camera;
-LE_SHARED le_result_t openCameraFd (const char *path, int *fd, tty_Speed_t baud, int nBytes, int timeout);
-LE_SHARED void sendCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs);
-LE_SHARED bool runCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen, bool flushFlag);
-LE_SHARED bool runCommandFlush (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen);
-LE_SHARED uint8_t readResponse (Camera *cam, uint8_t nBytes, uint8_t timeout);
+// File descriptor helpers
+LE_SHARED le_result_t fd_openCam (int *fd);
+LE_SHARED void fd_closeCam (int fd);
+LE_SHARED le_result_t fd_resetCamTty (int *fd);
+ssize_t fd_getByte (int fd, uint8_t *data);
+ssize_t fd_dataAvail (int fd, int *data);
+
+// Camera communication functions
+void sendCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs);
+bool runCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen, bool flushFlag);
+bool runCommandFlush (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen);
+uint8_t readResponse (Camera *cam, uint8_t nBytes, uint8_t timeout);
+bool verifyResponse (Camera *cam, uint8_t cmd);
+
+// High level commands to be called by
+// another component that requires this one
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);
@@ -86,6 +95,8 @@ 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);
+
+// File stream functions for reading photos
uint8_t getImageBlockSize (int jpgLen);
bool readImageBlock (Camera *cam, FILE *filePtr);
bool readImageToFile (Camera *cam, char *path);