camtypes.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * File: camtypes.h
4  *
5  *
6  * Description: Contains the datatypes, structures and enums that are used the API
7  *
8  * Copyright (C) 2018 CrossControl AB
9  * All rights reserved.
10  * Contact: CrossControl AB (info@crosscontrol.com)
11  *
12 **************************************************************************/
16 #ifndef CAMTYPES_H
17 #define CAMTYPES_H
18 
19 #include <string.h>
20 #include <stdint.h>
21 #include <sstream>
22 #include <vector>
23 #include <string>
24 
25 namespace CrossControl {
26 
31 enum ServiceID : uint16_t
32 {
33  SOME_IP = 0x433f,
34  SOME_IP_SD = 0xffff
35 };
36 
41 enum MethodID : uint16_t
42 {
43  GET_DATA_SHEET = 0x0001,
44  GET_CAM_STATUS = 0x0002,
45  SET_CAM_EXCLUSIVE = 0x0011,
51  GET_VIDEO_FORMAT = 0x0113,
54  SET_CAM_CONTROL = 0x0201,
55  GET_CAM_CONTROL = 0x0203,
56  SET_CAM_REGISTER = 0x0301,
57  SET_CAM_REGISTERS = 0x0302,
58  GET_CAM_REGISTER = 0x0303,
61 };
62 
67 {
68  E_OK = 0x00,
69  E_NOT_OK = 0x01,
72  E_NOT_READY = 0x04,
73  E_NOT_REACHABLE = 0x05,
74  E_TIMEOUT = 0x06,
79  E_LOCK_EXPIRED = 0x21,
80  E_NOT_LOCKED = 0x22,
84  E_NO_MORE_SPACE = 0x27,
95  E_SOCKET_ERR = 0x40,
97  E_NO_RESPONSE = 0x44
98 };
99 
104 enum MessageType : uint8_t
105 {
106  REQUEST = 0x00,
108  NOTIFICATION = 0x02,
109  REQUEST_ACK = 0x40,
112  RESPONSE = 0x80,
113  ERROR = 0x81,
114  RESPONSE_ACK = 0xc0,
115  ERROR_ACK = 0xc1
116 };
117 
122 enum EntryType : uint8_t
123 {
128  PUBLISH = 5,
131 };
132 
137 enum OptionType : uint8_t
138 {
144 };
145 
150 enum L4Protocol : uint8_t
151 {
152  TCP = 6,
153  UDP = 17
154 };
155 
160 enum ColorSpace : uint8_t
161 {
163  YUV411 = 1,
164  YUV422 = 2,
165  YUV444 = 3,
166  RGB8 = 4,
168  RGB16 = 6,
171  RAW8 = 9,
172  RAW16 = 10,
173  GRAYSCALE12 = 11,
174  RAW12 = 12
175 };
176 
180 enum ControlSupportMode : uint8_t
181 {
189  STAT_RO_A_O = 13,
191 };
192 
196 enum ControlMode : uint8_t
197 {
200  MODE_AUTO = 4,
202 };
203 
207 enum VideoCompression : uint8_t
208 {
210  JPEG = 1,
211  H264 = 2
212 };
213 
217 struct sImagerRegister
218 {
219  uint16_t regAddress;
220  uint16_t regValue;
222 } typedef ImagerRegister;
223 
227 struct sTimeStamp
228 {
229  uint16_t asExtension802;
230  uint32_t seconds;
231  uint32_t nanoSeconds;
233 } typedef TimeStamp;
234 
238 struct sVideoContent
239 {
240  uint8_t roiIndex;
241  uint16_t nBins;
242  uint16_t firstBin;
243  TimeStamp timeStamp;
244  uint32_t numberOfROIValues;
245  uint8_t roiContent[];
247 } typedef VideoContent;
248 
252 struct sCamStatus
253 {
254  uint32_t lockedBy;
255  uint8_t powerStatus;
256  uint16_t temperature;
258 } typedef CamStatus;
259 
263 struct sControlMode
264 {
268 } typedef ControlStatus;
269 
273 struct sSignedCtl
274 {
275  ControlStatus controlStatus;
276  int16_t controlValue;
278 } typedef SignedControl;
279 
283 struct sUnsignedCtl
284 {
285  ControlStatus controlStatus;
286  uint16_t controlValue;
288 } typedef UnsignedControl;
289 
293 struct sCombinedCtl
294 {
295  ControlStatus controlStatus;
296  uint8_t controlValueA;
297  uint8_t controlValueB;
299 } typedef CombinedControl;
300 
304 struct sPixelPosition
305 {
306  uint16_t x;
307  uint16_t y;
309 } typedef PixelPosition;
310 
314 struct sRectangle
315 {
316  PixelPosition p1;
317  PixelPosition p2;
318 } typedef Rectangle;
319 
323 struct sPixelMap
324 {
325  uint32_t numberOfEntries;
326  PixelPosition pixelPositions[];
328 } typedef PixelMap;
329 
333 struct sImageDimension
334 {
335  uint16_t width;
336  uint16_t height;
338 } typedef ImageDimension;
339 
343 struct sImagerCharacteristic
344 {
345  ImageDimension totalSize;
346  ImageDimension usableSize;
348  uint16_t pixelSizeX;
349  uint16_t pixelSizeY;
351  uint8_t shutterType;
352  char sensorIdentifier[32];
354 } typedef ImagerCharacteristic;
355 
360 struct sIntrinsicCamParam
361 {
362  uint8_t distortionModel;
366  double scaleX;
367  double scaleY;
369  double k1;
370  double k2;
371  double k3;
372  double k4;
373  double k5;
374  double k6;
376  double p1;
377  double p2;
379 } typedef IntrinsicCamParam;
380 
387 struct sExtrinsicCamParam
388 {
389  double rotationMat[9];
390  double tVec[3];
392 } typedef ExtrinsicCamParam;
393 
397 struct sDatasheet
398 {
399  char deviceIdenttification[256];
400  uint32_t standardVersion;
401  ImagerCharacteristic imagerCharacteristic;
402  IntrinsicCamParam intrinsicCamParam;
403  ExtrinsicCamParam extrinsicCamParam;
404  uint32_t numOfTemperatures;
407  PixelMap defectPixelMap;
409 } typedef Datasheet;
410 
414 struct sHistogramFormat
415 {
419  uint8_t dataType;
420  uint8_t binSize;
421  uint16_t numberOfBins;
423 } typedef HistogramFormat;
424 
429 struct sVideoFormat
430 {
433  uint16_t transmissionCycle;
435  ImageDimension widthAndHeight;
436  uint32_t frameRate;
437  uint8_t interlaced;
440  uint32_t maxBitrate;
444 } typedef VideoFormat;
445 
451 struct sRegionOfInterest
452 {
453  Rectangle roiSizeAndPosition;
454  VideoFormat videoFormat;
455  HistogramFormat histogramFormat;
457 } typedef RegionOfInterest;
458 
463 struct sSomeIPHeader
464 {
465  uint16_t serviceID;
466  uint16_t methodID;
467  uint32_t messageLength;
468  uint16_t clientID;
469  uint16_t sessionID;
470  uint8_t protocolVersion;
472  uint8_t messageType;
473  uint8_t returnCode;
474 } typedef SomeIPHeader;
475 
480 struct sSDEntryA
481 {
483  uint8_t indexOptions1;
484  uint8_t indexOptions2;
486  uint8_t numOptions1;
487  uint8_t numOptions2;
489  uint16_t serviceID;
490  uint16_t instanceID;
492  uint8_t majorVersion;
493  uint32_t timeToLive;
494  uint32_t minorVersion;
495 } typedef SDEntryA;
496 
501 struct sIPv4Option
502 {
503  std::string ipAddress;
505  uint16_t portNumber;
506 } typedef IPv4Option;
507 
508 
509 } //Namespace CrossControl
510 #endif // CAMTYPES_H
ControlSupportMode supportedModes
Definition: camtypes.h:265
Definition: camtypes.h:110
The sIPv4Option struct Describes the IPv4EndpointOption.
Definition: camtypes.h:501
PixelPosition p2
Definition: camtypes.h:317
uint8_t indexOptions2
Definition: camtypes.h:484
Definition: camtypes.h:60
uint32_t maxBitrate
Definition: camtypes.h:440
uint8_t histogramEnabled
Definition: camtypes.h:416
int16_t controlValue
Definition: camtypes.h:276
uint8_t videoFormatEnabled
Definition: camtypes.h:431
ControlStatus controlStatus
Definition: camtypes.h:275
uint8_t roiIndex
Definition: camtypes.h:240
uint32_t seconds
Definition: camtypes.h:230
Definition: camtypes.h:170
Definition: camtypes.h:109
uint32_t nanoSeconds
Definition: camtypes.h:231
Definition: camtypes.h:54
uint16_t regValue
Definition: camtypes.h:220
uint32_t numberOfROIValues
Definition: camtypes.h:244
Definition: camtypes.h:53
double p1
Definition: camtypes.h:376
uint8_t interfaceVersion
Definition: camtypes.h:471
Definition: camtypes.h:201
Definition of the image dimension, in pixels.
Definition: camtypes.h:333
double principalPointX
Definition: camtypes.h:364
uint16_t portNumber
Definition: camtypes.h:505
uint8_t powerStatus
Definition: camtypes.h:255
uint32_t lockedBy
Definition: camtypes.h:254
Definition: camtypes.h:43
Definition: camtypes.h:91
Definition: camtypes.h:87
Definition: camtypes.h:46
std::string ipAddress
Definition: camtypes.h:503
EntryType
The EntryType enum Describes what type of intent the Service Discovery Message has.
Definition: camtypes.h:122
Definition: camtypes.h:129
uint32_t numOfTemperatures
Definition: camtypes.h:404
uint16_t firstBin
Definition: camtypes.h:242
Definition: camtypes.h:86
Definition of a camera control mode register.
Definition: camtypes.h:263
Defines the histogram format used for a certain region of interest.
Definition: camtypes.h:414
ControlStatus controlStatus
Definition: camtypes.h:295
Defines the region of interest. The ROIs (regions of interest) are used to acquire data from the came...
Definition: camtypes.h:451
Definition: camtypes.h:96
uint16_t transmissionCycle
Definition: camtypes.h:433
Definition: camtypes.h:89
Definition: camtypes.h:152
Definition: camtypes.h:95
uint32_t messageLength
Definition: camtypes.h:467
Defines the parameter of the video format associated to certain region of interest link text ...
Definition: camtypes.h:429
uint16_t instanceID
Definition: camtypes.h:490
uint16_t width
Definition: camtypes.h:335
Definition: camtypes.h:172
MethodID
The MethodID enum Describes the different methods.
Definition: camtypes.h:41
Definition: camtypes.h:164
ControlMode
Is used to set the mode of operation of a certain camera control.
Definition: camtypes.h:196
uint8_t videoCompression
Definition: camtypes.h:441
uint8_t returnCode
Definition: camtypes.h:473
Definition: camtypes.h:142
Definition: camtypes.h:185
uint16_t asExtension802
Definition: camtypes.h:229
Rectangle roiSizeAndPosition
Definition: camtypes.h:453
uint8_t messageType
Definition: camtypes.h:472
uint16_t height
Definition: camtypes.h:336
uint16_t temperature
Definition: camtypes.h:256
ETHCamStatus
Returncodes and error messages. Can be sent from either the camera or the API.
Definition: camtypes.h:66
Definition: camtypes.h:80
Definition: camtypes.h:210
Definition: camtypes.h:25
Definition: camtypes.h:127
Definition: camtypes.h:125
Defines the camera status information.
Definition: camtypes.h:252
double scaleY
Definition: camtypes.h:367
PixelPosition p1
Definition: camtypes.h:316
The sSDEntryA struct A struct containing the Service Discovery Entry type A.
Definition: camtypes.h:480
Definition: camtypes.h:84
Definition: camtypes.h:165
uint32_t numberOfEntries
Definition: camtypes.h:325
Definition: camtypes.h:114
Definition: camtypes.h:71
The sSomeIPHeader struct A struct containg the SOME/IP header data.
Definition: camtypes.h:463
Definition: camtypes.h:56
Definition: camtypes.h:58
Definition: camtypes.h:45
Definition: camtypes.h:168
Definition: camtypes.h:130
uint32_t frameRate
Definition: camtypes.h:436
Definition: camtypes.h:108
Definition: camtypes.h:81
uint8_t distortionModel
Definition: camtypes.h:362
Definition: camtypes.h:52
Definition: camtypes.h:169
EntryType type
Definition: camtypes.h:482
TimeStamp timeStamp
Definition: camtypes.h:243
Definition: camtypes.h:69
double k6
Definition: camtypes.h:374
Definition: camtypes.h:113
uint16_t regAddress
Definition: camtypes.h:219
Definition: camtypes.h:34
double k3
Definition: camtypes.h:371
Definition: camtypes.h:167
Definition: camtypes.h:200
Definition: camtypes.h:49
ImagerCharacteristic imagerCharacteristic
Definition: camtypes.h:401
Definition: camtypes.h:124
Definition: camtypes.h:184
Definition: camtypes.h:55
uint8_t controlValueB
Definition: camtypes.h:297
Definition: camtypes.h:47
Definition: camtypes.h:163
uint32_t standardVersion
Definition: camtypes.h:400
Defines the characteristics of the camera.
Definition: camtypes.h:343
Definition: camtypes.h:73
Definition: camtypes.h:44
Definition: camtypes.h:48
Definition: camtypes.h:68
Definition: camtypes.h:174
Definition: camtypes.h:199
MessageType
The MessageType enum Describes what kind of intent a SOME/IP message has.
Definition: camtypes.h:104
Definition: camtypes.h:115
Definition: camtypes.h:77
Definition of an address/value pair of imager register.
Definition: camtypes.h:217
Definition: camtypes.h:83
Definition: camtypes.h:70
Definition: camtypes.h:111
uint8_t usedVideoComponent
Definition: camtypes.h:418
Definition: camtypes.h:198
ColorSpace
The ColorSpace enum. Vendor codes starting at 128 can be used for specific codec profiles.
Definition: camtypes.h:160
Definition: camtypes.h:187
Definition: camtypes.h:171
Definition: camtypes.h:33
uint8_t histogramUpdateCycle
Definition: camtypes.h:417
uint16_t serviceID
Definition: camtypes.h:489
uint16_t methodID
Definition: camtypes.h:466
Definition: camtypes.h:72
uint8_t interlaced
Definition: camtypes.h:437
L4Protocol protocol
Definition: camtypes.h:504
IntrinsicCamParam intrinsicCamParam
Definition: camtypes.h:402
Definition: camtypes.h:57
double principalPointY
Definition: camtypes.h:365
Definition: camtypes.h:166
Definition: camtypes.h:188
Definition: camtypes.h:182
Definition: camtypes.h:153
ImageDimension totalSize
Definition: camtypes.h:345
Definition: camtypes.h:97
double k2
Definition: camtypes.h:370
uint16_t y
Definition: camtypes.h:307
uint32_t maxLengthOfPersistentEntry
Definition: camtypes.h:406
PixelMap defectPixelMap
Definition: camtypes.h:407
uint8_t numOptions2
Definition: camtypes.h:487
Definition: camtypes.h:186
uint16_t clientID
Definition: camtypes.h:468
ColorSpace colorSpace
Definition: camtypes.h:439
uint8_t majorVersion
Definition: camtypes.h:492
uint32_t minorVersion
Definition: camtypes.h:494
uint16_t sessionID
Definition: camtypes.h:469
double scaleX
Definition: camtypes.h:366
The extrinsic camera parameters determine the mapping from 3-D vehicle coordinatesto 3-D camera coord...
Definition: camtypes.h:387
ServiceID
The ServiceID enum Describes wether the message is a SOME/IP or SOME/IP Service Discovery Message...
Definition: camtypes.h:31
uint8_t protocolVersion
Definition: camtypes.h:470
Definition: camtypes.h:183
uint16_t pixelSizeX
Definition: camtypes.h:348
Definition: camtypes.h:211
Definition: camtypes.h:74
uint16_t pixelSizeY
Definition: camtypes.h:349
Definition: camtypes.h:112
VideoFormat videoFormat
Definition: camtypes.h:454
Definition: camtypes.h:173
uint16_t x
Definition: camtypes.h:306
uint8_t controlValueA
Definition: camtypes.h:296
Definition: camtypes.h:189
ExtrinsicCamParam extrinsicCamParam
Definition: camtypes.h:403
Definition: camtypes.h:51
uint16_t numberOfBins
Definition: camtypes.h:421
ControlStatus controlStatus
Definition: camtypes.h:285
L4Protocol
The L4Protocol enum Desribes different internet data transmission protocols.
Definition: camtypes.h:150
VideoCompression
Enum that describes the different types of video compressions that can used. Vendor codes starting at...
Definition: camtypes.h:207
uint8_t transmissionMethod
Definition: camtypes.h:432
double k1
Definition: camtypes.h:369
OptionType
The OptionType enum Describes different options sent by Service Discovery messages.
Definition: camtypes.h:137
The intrinsic camera parameters determine the projection from 3-D camera coordinates to 2-D pixel coo...
Definition: camtypes.h:360
Definition: camtypes.h:190
Definition: camtypes.h:79
Definition: camtypes.h:209
Definition: camtypes.h:126
ImageDimension widthAndHeight
Definition: camtypes.h:435
uint8_t indexOptions1
Definition: camtypes.h:483
Defines a group of independent pixels. This structure is used, for instance, to report the position o...
Definition: camtypes.h:323
uint8_t dataType
Definition: camtypes.h:419
Definition of a rectangular area using two pixels coordinates.
Definition: camtypes.h:314
Definition of the position of a single pixel relative to a window. (0,0) Is the top left corner...
Definition: camtypes.h:304
uint16_t serviceID
Definition: camtypes.h:465
double p2
Definition: camtypes.h:377
Definition: camtypes.h:82
uint32_t timeToLive
Definition: camtypes.h:493
Definition of a timestamp.
Definition: camtypes.h:227
uint32_t numRegionsOfInterest
Definition: camtypes.h:405
Definition: camtypes.h:85
double k5
Definition: camtypes.h:373
uint8_t binSize
Definition: camtypes.h:420
Definition of a signed camera control.
Definition: camtypes.h:273
Definition of a combined camera control.
Definition: camtypes.h:293
uint8_t numOptions1
Definition: camtypes.h:486
Definition: camtypes.h:107
HistogramFormat histogramFormat
Definition: camtypes.h:455
Definition: camtypes.h:128
Definition: camtypes.h:140
uint16_t controlValue
Definition: camtypes.h:286
Definition of a unsigned camera control.
Definition: camtypes.h:283
Definition: camtypes.h:106
uint16_t nBins
Definition: camtypes.h:241
Definition: camtypes.h:143
Definition: camtypes.h:59
Definition: camtypes.h:90
Definition: camtypes.h:162
Definition: camtypes.h:139
ControlSupportMode
Defines the valid values for the supported modes of operation of camera controls. ...
Definition: camtypes.h:180
uint8_t shutterType
Definition: camtypes.h:351
ControlMode controlMode
Definition: camtypes.h:266
Defines the format of a video content notification package.
Definition: camtypes.h:238
ImageDimension usableSize
Definition: camtypes.h:346
Definition: camtypes.h:141
double k4
Definition: camtypes.h:372
Defines the characteristics of the camera.
Definition: camtypes.h:397