diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-12-13 20:56:06 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-12-13 20:56:06 -0800 |
commit | cf8b04744d6a56fb4859dc7a5dc56295577ce7d9 (patch) | |
tree | c27cd1a428ea5b25de47a1304ff42996b02061f6 /camera.h | |
parent | 9d1e6ad99708e8589cf77e4f27b9adec79044629 (diff) |
Update header file for new names
Diffstat (limited to 'camera.h')
-rw-r--r-- | camera.h | 89 |
1 files changed, 45 insertions, 44 deletions
@@ -2,6 +2,7 @@ #define CAMERA_H #include "legato.h" +#include <termios.h> #define VC0706_RESP_PREFIX 0x76 #define VC0706_PREFIX 0x56 @@ -43,6 +44,7 @@ #define CAM_BLOCK_SIZE 32 #define CAM_DELAY 10 #define CAM_SERIAL 0 +#define CAM_BAUD_RATE 38400 #define TTY_TIMEOUT 5000 static const char TTY_PATH[] = "/dev/ttyHS0"; @@ -55,51 +57,50 @@ typedef struct { uint16_t frameptr; } Camera; -// 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); +// File stream functions for reading photos +LE_SHARED bool cam_snapshotToFile (Camera *cam, char *path,uint8_t imgSize); +bool cam_readImageToFile (Camera *cam, char *path); +bool cam_readImageBlock (Camera *cam, FILE *filePtr); +uint8_t cam_getImageBlockSize (int jpgLen); -// 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); +// Higher level commands +LE_SHARED bool cam_setPTZ (Camera *cam, uint16_t wz, uint16_t hz, uint16_t pan, uint16_t tilt); +LE_SHARED bool cam_getPTZ (Camera *cam, uint16_t *w, uint16_t *h, uint16_t *wz, uint16_t *hz, uint16_t *pan, uint16_t *tilt); +LE_SHARED bool cam_setCompression (Camera *cam, uint8_t c); +LE_SHARED uint8_t cam_getCompression (Camera *cam); +LE_SHARED bool cam_setMotionStatus (Camera *cam, uint8_t x, uint8_t d1, uint8_t d2); +LE_SHARED bool cam_setMotionDetect (Camera *cam, bool flag); +LE_SHARED bool cam_motionDetected (Camera *cam); +LE_SHARED uint8_t cam_getMotionStatus (Camera *cam, uint8_t x); +LE_SHARED bool cam_getMotionDetect (Camera *cam); +LE_SHARED bool cam_setImageSize (Camera *cam,uint8_t x); +LE_SHARED uint8_t cam_getImageSize (Camera *cam); +LE_SHARED bool cam_setDownsize (Camera *cam, uint8_t newSize); +LE_SHARED uint8_t cam_getDownsize (Camera *cam); +LE_SHARED uint8_t cam_available (Camera *cam); +LE_SHARED char *cam_getVersion (Camera *cam); +LE_SHARED uint32_t cam_frameLength (Camera *cam); +LE_SHARED bool cam_resumeVideo (Camera *cam); +LE_SHARED uint8_t *cam_readPicture (Camera *cam, uint8_t n); +LE_SHARED bool cam_tvOff (Camera *cam); +LE_SHARED bool cam_tvOn(Camera *cam); +LE_SHARED bool cam_reset(Camera *cam); +LE_SHARED bool cam_takePicture(Camera *cam); +LE_SHARED bool cam_frameBuffCtrl(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 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); +// Low level camera commands +bool cam_runCommandFlush (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen); +bool cam_verifyResponse (Camera *cam, uint8_t cmd); +uint8_t cam_readResponse (Camera *cam, uint8_t nBytes, uint8_t timeout); +bool cam_runCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs, uint8_t respLen, bool flushFlag); +void cam_sendCommand (Camera *cam, uint8_t cmd, uint8_t args[], uint8_t nArgs); -// File stream functions for reading photos -uint8_t getImageBlockSize (int jpgLen); -bool readImageBlock (Camera *cam, FILE *filePtr); -bool readImageToFile (Camera *cam, char *path); -LE_SHARED bool snapshotToFile (Camera *cam, char *path, uint8_t imgSize); +// Serial/file descriptor helpers +int fd_dataAvail (int fd, int *data); +ssize_t fd_getByte (int fd, uint8_t *data); +LE_SHARED int fd_closeCam (int fd); +LE_SHARED int fd_openCam (); +int fd_openSerial (const char *device, int baud); +speed_t fd_convertBaud (int baud); -#endif +#endif
\ No newline at end of file |