AURobotServers  4
uimgpushtest.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Christian Andersen *
3  * jca@oersted.dtu.dk *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef UIMGPUSHTEST_H
21 #define UIMGPUSHTEST_H
22 
23 #include <ugen4/uimage2.h>
24 //#include <ugen4/urawimage.h>
25 
26 #include "uimgsockserv.h"
27 #include "ucomcam.h"
28 #include "usockclient.h"
35 class UImgSockServPushTestConn : public UImgSockServConn
36 {
37 public:
40  virtual void gotNewMessage(unsigned char * message, int length);
41 
42 };
43 
45 
48 class UImgSockServPushTest : public UImgSockServ
49 {
50 public:
54  void initialize();
55 
56 public:
58  bool finished;
59 };
60 
61 
63 
67 {
68 public:
72  virtual ~UImgClientTest();
75  bool blockSend(const char * buffer, int length);
78  bool sendTimeRequest();
83  bool sendCameraInfoRequest(bool allCams);
88  bool sendCameraParameterRequest();
93  bool sendImageMetaRequest(int sourceNum);
98  bool sendImageCaptureRequest(bool removeRadialError,
99  int imageFormat);
109  bool sendGetImage(int sourceNum,
110  unsigned int device,
111  bool tryPacked,
112  int line = -1,
113  int format = -1);
118  bool sendNewCameraSettings2(UComCam * cs);
133  bool sendNewCameraSettings(int dev, int w, int h,
134  int fps, long imNum,
135  bool repeatNewImages,
136  bool newPosition,
137  UPosition newPos,
138  bool newRotation,
139  URotation newRot,
140  bool ensureOpen);
148  bool sendNewCameraParameters(
149  const float radialK1,
150  const float radialK2,
151  const float focalLength,
152  const float headX,
153  const float headY);
157  bool sendCameraCalibrateRequest(
158  bool analyzeImage,
159  int imageSource,
160  bool clearAllData,
161  bool clearSpecificData,
162  float blockSize,
163  bool findCameraParams,
164  bool alsoFocalLength,
165  bool alsoK1, bool alsoK2,
166  unsigned long setsToUse,
167  bool extraImages);
174  bool sendBarcodeExecute(int sourceImage,
175  bool findCode,
176  bool extraImages,
177  bool nearGMK,
178  bool findPosition, bool findRotation,
179  bool findChartPosition,
180  bool clearOldData, bool findCameraParameters,
181  int frameSize, float blockSize, int codeBlockFactor,
182  int maxCodesToLookFor,
183  float chartHeight, // height of barcode center for cam calib
184  unsigned char specificCodeLng,
185  int specificCode[]);
189  bool sendCameraClose();
192  bool sendCameraMaster();
195  bool sendPantiltInfoRequest();
198  bool sendPantiltPosRequest(
199  bool reset,
200  bool relative,
201  int pan, int tilt);
202 
203 
204 protected:
207  bool decodeTimeMsg(unsigned char * msg);
212  bool decodeCameraInfoMsg(unsigned char * msg);
216  bool decodeCameraInfoMsg2(unsigned char * msg);
221  bool decodeCameraParamMsg(unsigned char * msg);
224  bool decodeImageMetaData(unsigned char * msg);
230  bool decodeImageData(unsigned char * msg);
234  void processMessage(unsigned char * data, int length);
238  int decodeMessages();
244  bool decodeDone(unsigned char * msg);
248  bool decodeBarcodeCode(unsigned char * msg);
252  bool decodePantiltPosition(unsigned char * msg);
255  virtual void imageMetaUpdated(int imageSlot);
262  virtual void imageUpdated(unsigned int serial,
263  int source,
264  int row, bool isBW);
267  virtual void cameraDataUpdated(int device);
270  //virtual void barcodeDataUpdated(int codeNumber);
273  virtual void timeUpdated() {;};
278  virtual void sInfo(const char * message, int type);
279 
280 public:
289  //
290  // image format
291  // bool tryPacked;
307 
308  // partially received image
309  UImage640 * rgbImage; // unpacked image data
310  URawImage * rawImage; // image in YUV:4:2:0 format
311  // received image data
313  // debug and control
315  //
317 protected:
318  bool receiving;
320  unsigned char message[MAX_MESSAGE_LENGTH_FROM_CAM * 2];
324  int serial;
329 };
330 
331 #endif
int imagesReceived
Definition: uimgpushtest.h:306
bool dataBuffersCreated
Definition: uimgpushtest.h:312
int data[2][CHUNK]
Definition: comedi_reader.c:72
UComCam ccam
Definition: uimgpushtest.h:316
int formatMajor
Definition: uimgpushtest.h:286
int messageCnt
Definition: uimgpushtest.h:322
Definition: uimgpushtest.h:48
bool verboseMessages
Definition: uimgpushtest.h:314
bool reqOutstanding
Definition: uimgpushtest.h:295
Definition: u3d.h:72
Definition: augclient/globals.h:129
UTime startTime
Definition: uimgpushtest.h:301
virtual void gotNewMessage(unsigned char *message, int length)
UTime timeServ
Definition: uimgpushtest.h:284
Definition: utime.h:34
UTime reqTime
Definition: uimgpushtest.h:297
Definition: uimgpushtest.h:66
Definition: ucam4/ucomcam.h:36
Definition: u3d.h:403
Definition: uimage2.h:54
URawImage * rawImage
Definition: uimgpushtest.h:310
int selectedDeviceNumber
Definition: uimgpushtest.h:328
#define MAX_CLIENTS_SERVED
Definition: usockserv.h:29
int reqMessageSerial
Definition: uimgpushtest.h:296
Definition: uimgpushtest.h:35
int formatMinor
Definition: uimgpushtest.h:288
virtual void timeUpdated()
Definition: uimgpushtest.h:273
Definition: usockclient.h:47
int tryColorFormat
Definition: uimgpushtest.h:293
int serial
Definition: uimgpushtest.h:324
UTime startTimeClient
Definition: uimgpushtest.h:303
bool receiving
Definition: uimgpushtest.h:318
UImage640 * rgbImage
Definition: uimgpushtest.h:309
bool finished
Definition: uimgpushtest.h:58
UTime recvTime
Definition: uimgpushtest.h:299