Spectrometer library  2.1
Simplified version of the thread-safe core
libspectr.h File Reference
#include <stdint.h>

Classes

struct  DeviceInfo_t
 

Macros

#define LIBSHARED_AND_STATIC_EXPORT   __declspec(dllimport)
 
#define LIBSHARED_AND_STATIC_NO_EXPORT
 
#define LIBSHARED_AND_STATIC_DEPRECATED   __declspec(deprecated)
 
#define LIBSHARED_AND_STATIC_DEPRECATED_EXPORT   LIBSHARED_AND_STATIC_EXPORT __declspec(deprecated)
 
#define LIBSHARED_AND_STATIC_DEPRECATED_NO_EXPORT   LIBSHARED_AND_STATIC_NO_EXPORT __declspec(deprecated)
 
#define DEFINE_NO_DEPRECATED   0
 
#define DEVICE_INFO
 
#define SPECTROMETER_ERROR_CODES
 
#define OK   0
 
#define CONNECT_ERROR_WRONG_ID   500
 
#define CONNECT_ERROR_NOT_FOUND   501
 
#define CONNECT_ERROR_FAILED   502
 
#define DEVICE_NOT_INITIALIZED   503
 
#define WRITING_PROCESS_FAILED   504
 
#define READING_PROCESS_FAILED   505
 
#define WRONG_ANSWER   506
 
#define GET_FRAME_REMAINING_PACKETS_ERROR   507
 
#define NUM_OF_PACKETS_IN_FRAME_ERROR   508
 
#define INPUT_PARAMETER_NOT_INITIALIZED   509
 
#define READ_FLASH_REMAINING_PACKETS_ERROR   510
 
#define CONNECT_ERROR_WRONG_SERIAL_NUMBER   516
 
#define NO_DEVICE_CONTEXT_ERROR   585
 

Typedefs

typedef unsigned char uint8_t
 
typedef unsigned short uint16_t
 
typedef unsigned int uint32_t
 
typedef struct DeviceInfo_t DeviceInfo_t
 

Functions

LIBSHARED_AND_STATIC_EXPORT int disconnectDeviceContext (uintptr_t *deviceContextPtr)
 Free a device handle. More...
 
LIBSHARED_AND_STATIC_EXPORT int connectToDeviceBySerial (const char *const serialNumber, uintptr_t *deviceContextPtr)
 Finds the requested device by the provided serial number and connects to it. This function or its analog connectToDeviceByIndex() should always precede all other library operations. More...
 
LIBSHARED_AND_STATIC_EXPORT int connectToDeviceByIndex (unsigned int index, uintptr_t *deviceContextPtr)
 Connects to the required device by index. More...
 
LIBSHARED_AND_STATIC_EXPORT uint32_t getDevicesCount ()
 Returns the number of the connected devices.
 
LIBSHARED_AND_STATIC_EXPORT DeviceInfo_tgetDevicesInfo ()
 Obtains the list of all connected devices. Run clearDevicesInfo() with the result of this function to clear it [Mandatory] structure information: struct DeviceInfo_t { char* serial; //descriptor to the string with serial number struct DeviceInfo_t *next; //descriptor to the next element of the list or null if last element }. More...
 
LIBSHARED_AND_STATIC_EXPORT void clearDevicesInfo (DeviceInfo_t *devices)
 Clears the list of all connected devices obtained by getDevicesInfo() function.
 
LIBSHARED_AND_STATIC_EXPORT int setFrameFormat (uint16_t numOfStartElement, uint16_t numOfEndElement, uint8_t reductionMode, uint16_t *numOfPixelsInFrame, uintptr_t *deviceContextPtr)
 Sets frame parameters. More...
 
LIBSHARED_AND_STATIC_EXPORT int setExposure (uint32_t timeOfExposure, uint8_t force, uintptr_t *deviceContextPtr)
 Sets exposure parameter. More...
 
LIBSHARED_AND_STATIC_EXPORT int setAcquisitionParameters (uint16_t numOfScans, uint16_t numOfBlankScans, uint8_t scanMode, uint32_t timeOfExposure, uintptr_t *deviceContextPtr)
 Sets acquisition parameters. More...
 
LIBSHARED_AND_STATIC_EXPORT int setMultipleParameters (uint16_t numOfScans, uint16_t numOfBlankScans, uint8_t scanMode, uint32_t timeOfExposure, uint8_t enableMode, uint8_t signalFrontMode, uintptr_t *deviceContextPtr)
 Sets multiple parameters - combination of setAcquisitionParameters() and setExternalTrigger() functions Clears memory and sets the required parameters (the parameters for the setAcquisitionParameters() and setExternalTrigger() functions). If enableMode = 0 or signalFrontMode = 0 (external trigger disabled) this function also triggers the acquisition. More...
 
LIBSHARED_AND_STATIC_EXPORT int setExternalTrigger (uint8_t enableMode, uint8_t signalFrontMode, uintptr_t *deviceContextPtr)
 Sets the external acquisition trigger. More...
 
LIBSHARED_AND_STATIC_EXPORT int setOpticalTrigger (uint8_t enableMode, uint16_t pixel, uint16_t threshold, uintptr_t *deviceContextPtr)
 Sets the optical atrigger. More...
 
LIBSHARED_AND_STATIC_EXPORT int triggerAcquisition (uintptr_t *deviceContextPtr)
 Start acquisition by software. More...
 
LIBSHARED_AND_STATIC_EXPORT int getStatus (uint8_t *statusFlags, uint16_t *framesInMemory, uintptr_t *deviceContextPtr)
 Gets the device status. More...
 
LIBSHARED_AND_STATIC_EXPORT int getAcquisitionParameters (uint16_t *numOfScans, uint16_t *numOfBlankScans, uint8_t *scanMode, uint32_t *timeOfExposure, uintptr_t *deviceContextPtr)
 Returns the same values as set by setAcquisitionParameters() More...
 
LIBSHARED_AND_STATIC_EXPORT int getFrameFormat (uint16_t *numOfStartElement, uint16_t *numOfEndElement, uint8_t *reductionMode, uint16_t *numOfPixelsInFrame, uintptr_t *deviceContextPtr)
 Returns the same values as set by setFrameFormat() More...
 
LIBSHARED_AND_STATIC_EXPORT int getFrame (uint16_t *framePixelsBuffer, uint16_t numOfFrame, uintptr_t *deviceContextPtr)
 Gets frame. More...
 
LIBSHARED_AND_STATIC_EXPORT int clearMemory (uintptr_t *deviceContextPtr)
 Clears memory. More...
 
LIBSHARED_AND_STATIC_EXPORT int eraseFlash (uintptr_t *deviceContextPtr)
 Erases user flash memory. More...
 
LIBSHARED_AND_STATIC_EXPORT int readFlash (uint8_t *buffer, uint32_t absoluteOffset, uint32_t bytesToRead, uintptr_t *deviceContextPtr)
 Reads from user flash memory Reads bytesToRead from user flash memory starting at offset and copies them to the buffer. More...
 
LIBSHARED_AND_STATIC_EXPORT int writeFlash (uint8_t *buffer, uint32_t absoluteOffset, uint32_t bytesToWrite, uintptr_t *deviceContextPtr)
 Writes bytesToWrite bytes from the buffer to the user flash memory starting at offset. More...
 
LIBSHARED_AND_STATIC_EXPORT int resetDevice (uintptr_t *deviceContextPtr)
 Resets all the device parameters to their default values and clears the memory. More...
 
LIBSHARED_AND_STATIC_EXPORT int detachDevice (uintptr_t *deviceContextPtr)
 Disconnects the device. More...
 

Function Documentation

§ getDevicesInfo()

LIBSHARED_AND_STATIC_EXPORT DeviceInfo_t* getDevicesInfo ( )

Obtains the list of all connected devices. Run clearDevicesInfo() with the result of this function to clear it [Mandatory] structure information: struct DeviceInfo_t { char* serial; //descriptor to the string with serial number struct DeviceInfo_t *next; //descriptor to the next element of the list or null if last element }.

Returns
the list of all connected devices (afterwards should be freed with clearDevicesInfo() function!)