$search
00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2009, 2010 Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of the Willow Garage nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00035 #ifndef _WGE100LIB_H_ 00036 #define _WGE100LIB_H_ 00037 #include <stdint.h> 00038 #include "list.h" 00039 #include "ipcam_packet.h" 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 00046 /* 00047 * Firmware version number 00048 */ 00049 #define WGE100LIB_VERSION_MAJOR 0x01 00050 #define WGE100LIB_VERSION_MINOR 0x05 00051 #define WGE100LIB_VERSION ((WGE100LIB_VERSION_MAJOR <<8) | WGE100LIB_VERSION_MINOR ) 00052 00053 00054 /* 00055 * Trigger Modes 00056 */ 00057 00058 #define TRIG_STATE_INTERNAL 0 00059 #define TRIG_STATE_EXTERNAL 1 00060 #define TRIG_STATE_ALTERNATE 4 00061 #define TRIG_STATE_RISING 2 00062 00063 /* 00064 * The wge100FrameInfo structure is returned to the frame handler 00065 */ 00066 typedef struct 00067 { 00068 size_t width; 00069 size_t height; 00070 00071 uint32_t frame_number; 00072 00073 size_t lastMissingLine; 00074 size_t missingLines; 00075 int shortFrame; 00076 00077 uint8_t *frameData; 00078 PacketEOF *eofInfo; 00079 00080 struct timeval startTime; 00081 } wge100FrameInfo; 00082 00083 00084 00085 int wge100LibVersion( void ); 00086 00087 int wge100FindByUrl(const char *url, IpCamList *camera, unsigned wait_us, const char **errmsg); 00088 int wge100Discover(const char *ifName, IpCamList *ipCamList, const char *ipAddress, unsigned wait_us); 00089 int wge100Configure( IpCamList *camInfo, const char *ipAddress, unsigned wait_us); 00090 int wge100StartVid( const IpCamList *camInfo, const uint8_t mac[6], const char *ipAddress, uint16_t port ); 00091 int wge100StopVid( const IpCamList *camInfo ); 00092 int wge100Reset( IpCamList *camInfo ); 00093 int wge100ReconfigureFPGA( IpCamList *camInfo ); 00094 int wge100GetTimer( const IpCamList *camInfo, uint64_t *time_us ); 00095 int wge100ReliableFlashRead( const IpCamList *camInfo, uint32_t address, uint8_t *pageDataOut, int *retries ); 00096 int wge100FlashRead( const IpCamList *camInfo, uint32_t address, uint8_t *pageDataOut ); 00097 int wge100ReliableFlashWrite( const IpCamList *camInfo, uint32_t address, const uint8_t *pageDataIn, int *retries ); 00098 int wge100FlashWrite( const IpCamList *camInfo, uint32_t address, const uint8_t *pageDataIn ); 00099 int wge100ReliableSensorRead( const IpCamList *camInfo, uint8_t reg, uint16_t *data, int *retries ); 00100 int wge100SensorRead( const IpCamList *camInfo, uint8_t reg, uint16_t *data ); 00101 int wge100ReliableSensorWrite( const IpCamList *camInfo, uint8_t reg, uint16_t data, int *retries ); 00102 int wge100SensorWrite( const IpCamList *camInfo, uint8_t reg, uint16_t data ); 00103 int wge100ConfigureBoard( const IpCamList *camInfo, uint32_t serial, MACAddress *mac ); 00104 int wge100TriggerControl( const IpCamList *camInfo, uint32_t triggerType ); 00105 int wge100SensorSelect( const IpCamList *camInfo, uint8_t index, uint32_t reg ); 00106 int wge100ImagerSetRes( const IpCamList *camInfo, uint16_t horizontal, uint16_t vertical ); 00107 int wge100ImagerModeSelect( const IpCamList *camInfo, uint32_t mode ); 00108 00110 typedef int (*FrameHandler)(wge100FrameInfo *frame_info, void *userData); 00111 int wge100VidReceive( const char *ifName, uint16_t port, size_t height, size_t width, FrameHandler frameHandler, void *userData ); 00112 int wge100VidReceiveAuto( IpCamList *camera, size_t height, size_t width, FrameHandler frameHandler, void *userData ); 00113 00114 #define CONFIG_PRODUCT_ID 6805018 00115 #define ERR_TIMEOUT 100 00116 #define ERR_CONFIG_ARPFAIL 200 00117 00118 #ifdef __cplusplus 00119 } 00120 #endif 00121 00122 #endif // _WGE100LIB_H_