PrimeSense.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 *                                                                            *
00003 *  OpenNI 2.x Alpha                                                          *
00004 *  Copyright (C) 2012 PrimeSense Ltd.                                        *
00005 *                                                                            *
00006 *  This file is part of OpenNI.                                              *
00007 *                                                                            *
00008 *  Licensed under the Apache License, Version 2.0 (the "License");           *
00009 *  you may not use this file except in compliance with the License.          *
00010 *  You may obtain a copy of the License at                                   *
00011 *                                                                            *
00012 *      http://www.apache.org/licenses/LICENSE-2.0                            *
00013 *                                                                            *
00014 *  Unless required by applicable law or agreed to in writing, software       *
00015 *  distributed under the License is distributed on an "AS IS" BASIS,         *
00016 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
00017 *  See the License for the specific language governing permissions and       *
00018 *  limitations under the License.                                            *
00019 *                                                                            *
00020 *****************************************************************************/
00021 #ifndef PRIMESENSE_H
00022 #define PRIMESENSE_H
00023 
00024 #include <OniCTypes.h>
00025 
00037 enum
00038 {
00039         // Stream Properties
00040         PS_PROPERTY_DUMP_DATA = 0x1d270001, // boolean
00041         PS_PROPERTY_GAIN = 0x1d270002, // int - system specific
00042 
00043         // Device Properties
00044     PS_PROPERTY_USB_INTERFACE = 0x1d27F001, // values from XnUsbInterfaceType
00045 };
00046 
00055 enum
00056 {
00057         // Device Commands - use via invoke()
00058         PS_COMMAND_AHB_READ = 0x1d27E001, // XnCommandAHB
00059         PS_COMMAND_AHB_WRITE = 0x1d27E002, // XnCommandAHB
00060         PS_COMMAND_I2C_READ = 0x1d27E003, // XnCommandI2C
00061         PS_COMMAND_I2C_WRITE = 0x1d27E004, // XnCommandI2C
00062         PS_COMMAND_SOFT_RESET = 0x1d27E005, // no arguments
00063         PS_COMMAND_POWER_RESET = 0x1d27E006, // no arguments
00064         PS_COMMAND_BEGIN_FIRMWARE_UPDATE = 0x1d27E007, // no arguments
00065         PS_COMMAND_END_FIRMWARE_UPDATE = 0x1d27E008, // no arguments
00066         PS_COMMAND_UPLOAD_FILE = 0x1d27E009, // XnCommandUploadFile
00067         PS_COMMAND_DOWNLOAD_FILE = 0x1d27E00A, // XnCommandDownloadFile
00068         PS_COMMAND_GET_FILE_LIST = 0x1d27E00B, // an array of XnFileEntry
00069         PS_COMMAND_FORMAT_ZONE = 0x1d27E00C, // XnCommandFormatZone
00070         PS_COMMAND_DUMP_ENDPOINT = 0x1d27E00D, // XnCommandDumpEndpoint
00071         PS_COMMAND_GET_I2C_DEVICE_LIST = 0x1d27E00E, // XnCommandGetI2CDevices
00072         PS_COMMAND_GET_BIST_LIST = 0x1d27E00F, // XnCommandGetBistList
00073         PS_COMMAND_EXECUTE_BIST = 0x1d27E010, // XnCommandExecuteBist
00074         PS_COMMAND_USB_TEST = 0x1d27E011, // XnCommandUsbTest
00075         PS_COMMAND_GET_LOG_MASK_LIST = 0x1d27E012, // XnCommandGetLogMaskList
00076         PS_COMMAND_SET_LOG_MASK_STATE = 0x1d27E013, // XnCommandSetLogMaskState
00077         PS_COMMAND_START_LOG = 0x1d27E014, // no arguments
00078     PS_COMMAND_STOP_LOG = 0x1d27E015, // no arguments
00079     PS_COMMAND_READ_TEMPERATURE = 0x1d27E016, // no arguments    
00080     PS_COMMAND_GET_TEMP_LIST = 0x1d27E017,// PrintTempList
00081     PS_COMMAND_READ_DEBUG_DATA = 0x1d27E018, //ReadDebugDaata
00082 };
00083 
00084 typedef enum XnUsbInterfaceType
00085 {
00086         PS_USB_INTERFACE_DONT_CARE = 0,
00087         PS_USB_INTERFACE_ISO_ENDPOINTS = 1,
00088         PS_USB_INTERFACE_BULK_ENDPOINTS = 2,
00089 } XnUsbInterfaceType;
00090 
00091 #pragma pack (push, 1)
00092 
00093 // Data Types
00094 typedef struct XnFwFileVersion
00095 {
00096         uint8_t major;
00097         uint8_t minor;
00098         uint8_t maintenance;
00099         uint8_t build;
00100 } XnFwFileVersion;
00101 
00102 typedef enum XnFwFileFlags
00103 {
00104         XN_FILE_FLAG_BAD_CRC                                    = 0x0001,
00105 } XnFwFileFlags;
00106 
00107 typedef struct XnFwFileEntry
00108 {
00109         char name[32];
00110         XnFwFileVersion version;
00111         uint32_t address;
00112         uint32_t size;
00113         uint16_t crc;
00114         uint16_t zone;
00115         XnFwFileFlags flags; // bitmap 
00116 } XnFwFileEntry;
00117 
00118 typedef struct XnI2CDeviceInfo
00119 {
00120     uint8_t masterId;
00121     uint8_t slaveId;
00122         uint32_t id;
00123         char name[32];
00124 } XnI2CDeviceInfo;
00125 
00126 typedef struct XnBistInfo
00127 {
00128         uint32_t id;
00129         char name[32];
00130 } XnBistInfo;
00131 
00132 typedef struct XnTempInfo
00133 {
00134     uint32_t id;
00135     char name[16];
00136 } XnTempInfo;
00137 
00138 typedef struct XnFwLogMask
00139 {
00140         uint32_t id;
00141         char name[32];
00142 } XnFwLogMask;
00143 
00144 typedef struct XnUsbTestEndpointResult
00145 {
00146         double averageBytesPerSecond;
00147         uint32_t lostPackets;
00148 } XnUsbTestEndpointResult;
00149 
00150 // Commands
00151 
00152 typedef struct XnCommandAHB
00153 {
00154         uint32_t address;               // Address of this register
00155         uint32_t offsetInBits;  // Offset of the field in bits within address
00156         uint32_t widthInBits;   // Width of the field in bits
00157         uint32_t value;                 // For read requests, this is where the actual value will be filled. For write requests, the value to write.
00158 } XnCommandAHB;
00159 
00160 typedef struct XnCommandI2C
00161 {
00162         uint32_t deviceID;              // Device to communicate with
00163         uint32_t addressSize;   // Size of the address, in bytes (1-4)
00164         uint32_t address;               // Address
00165         uint32_t valueSize;             // Size of the value, in bytes (1-4)
00166         uint32_t mask;                  // For write request - a mask to be applied to the value. For read requests - ignored.
00167         uint32_t value;                 // For write request - the value to be written. For read requests - the place where the actual value is written to
00168 } XnCommandI2C;
00169 
00170 typedef struct XnCommandUploadFile  
00171 {
00172         const char* filePath;
00173         uint32_t uploadToFactory;
00174 } XnCommandUploadFile;  
00175 
00176 typedef struct XnCommandDownloadFile  
00177 {
00178         uint16_t zone;
00179         const char*  firmwareFileName;
00180         const char*  targetPath;
00181 } XnCommandDownloadFile;  
00182 
00183 typedef struct XnCommandGetFileList
00184 {
00185         uint32_t count;         // in: number of allocated elements in files array. out: number of written elements in the array
00186         XnFwFileEntry* files;
00187 } XnCommandGetFileList;
00188 
00189 typedef struct XnCommandFormatZone 
00190 {
00191         uint8_t zone;
00192 } XnCommandFormatZone;
00193 
00194 typedef struct XnCommandDumpEndpoint
00195 {
00196         uint8_t endpoint;
00197         bool enabled;
00198 } XnCommandDumpEndpoint;
00199 
00200 typedef struct XnCommandGetI2CDeviceList
00201 {
00202         uint32_t count; // in: number of allocated elements in devices array. out: number of written elements in the array
00203         XnI2CDeviceInfo* devices;
00204 } XnCommandGetI2CDeviceList;
00205 
00206 typedef struct XnCommandGetBistList
00207 {
00208         uint32_t count; // in: number of allocated elements in tests array. out: number of written elements in the array
00209         XnBistInfo* tests;
00210 } XnCommandGetBistList;
00211 
00212 typedef struct XnCommandGetTempList
00213 {
00214         uint32_t count; // in: number of allocated elements in tests array. out: number of written elements in the array
00215         XnTempInfo* pTempInfos;
00216 } XnCommandGetTempList;
00217 
00218 typedef struct XnCommandExecuteBist
00219 {
00220         uint32_t id;
00221         uint32_t errorCode;
00222         uint32_t extraDataSize; // in: number of allocated bytes in extraData. out: number of written bytes in extraData
00223         uint8_t* extraData;
00224 } XnCommandExecuteBist;
00225 
00226 typedef struct XnCommandTemperatureResponse
00227 {
00228     uint32_t id;
00229     float temperature;
00230 } XnCommandTemperatureResponse;
00231 
00232 typedef struct XnCommandUsbTest
00233 {
00234         uint32_t seconds;
00235         uint32_t endpointCount; // in: number of allocated bytes in endpoints array. out: number of written bytes in array
00236         XnUsbTestEndpointResult* endpoints;
00237 } XnCommandUsbTest;
00238 
00239 typedef struct XnCommandGetLogMaskList
00240 {
00241         uint32_t count; // in: number of allocated elements in masks array. out: number of written elements in the array
00242         XnFwLogMask* masks;
00243 } XnCommandGetLogMaskList;
00244 
00245 typedef struct XnCommandSetLogMaskState
00246 {
00247         uint32_t mask;
00248         bool enabled;
00249 } XnCommandSetLogMaskState;
00250 
00251 typedef struct XnCommandDebugData
00252 {
00253     uint16_t dataID;    // Values come from XnLinkInternalPropID
00254     uint16_t dataSize;  // in: size of allocated buffer in data, out: actual bytes written to data
00255     uint8_t* data;
00256 } XnCommandDebugData;
00257 
00258 #pragma pack (pop)
00259 
00260 #endif // PRIMESENSE_H


astra_camera
Author(s): Tim Liu
autogenerated on Wed Jul 10 2019 03:18:54