1 //+----------------------------------------------------------------------------
5 // Module: Kodak DC210 plus communication program
7 // Synopsis: Program entry point.
9 // Copyright (c) 1999 Scott Gasch
10 // All rights reserved.
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
21 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 // $Id: main.cpp,v 1.3 2000/01/15 18:34:30 scott Exp scott $
39 //+----------------------------------------------------------------------------
52 #include "dc210camera.h"
53 #include "dc210photo.h"
55 CKodakDC210 camera("/dev/cuaa0", 38400);
63 //+----------------------------------------------------------------------------
67 // Synopsis: Print out a brief description of command syntax and exit.
73 // History: sgasch Created Header 22 Jun 1999
75 //+----------------------------------------------------------------------------
79 "camera [-d][-p serial-device][-BYTE baud-rate] command "
86 //+----------------------------------------------------------------------------
90 // Synopsis: Main entry point; parse arguments and control camera.
92 // Arguments: int argc - arg count
93 // char *argv[] - arguments
95 // Returns: int - status to OS
97 // History: sgasch Created Header 22 Jun 1999
99 //+----------------------------------------------------------------------------
100 int main(int argc, char *argv[])
105 while ((ch = getopt(argc, argv, "p:b:d?h")) != -1)
110 // We are in debug mode -- extra tracing and more retries.
116 g_iSpeed = atoi(optarg);
117 if ((g_iSpeed != 9600) && (g_iSpeed != 19200) &&
118 (g_iSpeed != 38400) && (g_iSpeed != 57600) &&
119 (g_iSpeed != 115200))
121 Trace("main: Illegal speed (%d) specified; legal speeds "
123 "9600, 19200, 38400, 57600, and 115200.\n\n"
124 "main: Defaulting to to 9600 baud.\n", g_iSpeed);
129 memset(g_szCameraSerialPort, 0, PATH_MAX);
130 strncpy(g_szCameraSerialPort, optarg, PATH_MAX);
144 if (NULL == (gets(szCommand)))
149 if (!strcasecmp("snap", szCommand))
151 Trace("Snapping...\n");
152 (void) camera.TakePicture();