|
Data Structures |
struct | _CPhidgetIR_CodeInfo |
Defines |
#define | IR_MAX_CODE_BIT_COUNT 128 |
#define | IR_MAX_CODE_DATA_LENGTH (IR_MAX_CODE_BIT_COUNT / 8) |
#define | IR_MAX_REPEAT_LENGTH 26 |
Typedefs |
typedef struct _CPhidgetIR * | CPhidgetIRHandle |
typedef struct _CPhidgetIR_CodeInfo | CPhidgetIR_CodeInfo |
typedef struct
_CPhidgetIR_CodeInfo * | CPhidgetIR_CodeInfoHandle |
Enumerations |
enum | CPhidgetIR_Encoding {
PHIDGET_IR_ENCODING_UNKNOWN = 1,
PHIDGET_IR_ENCODING_SPACE,
PHIDGET_IR_ENCODING_PULSE,
PHIDGET_IR_ENCODING_BIPHASE,
PHIDGET_IR_ENCODING_RC5,
PHIDGET_IR_ENCODING_RC6
} |
enum | CPhidgetIR_Length { PHIDGET_IR_LENGTH_UNKNOWN = 1,
PHIDGET_IR_LENGTH_CONSTANT,
PHIDGET_IR_LENGTH_VARIABLE
} |
Functions |
int | CPhidgetIR_create (CPhidgetIRHandle *phid) |
int | CPhidgetIR_Transmit (CPhidgetIRHandle phid, unsigned char *data, CPhidgetIR_CodeInfoHandle codeInfo) |
int | CPhidgetIR_TransmitRepeat (CPhidgetIRHandle phid) |
int | CPhidgetIR_TransmitRaw (CPhidgetIRHandle phid, int *data, int length, int carrierFrequency, int dutyCycle, int gap) |
int | CPhidgetIR_getRawData (CPhidgetIRHandle phid, int *data, int *dataLength) |
int | CPhidgetIR_getLastCode (CPhidgetIRHandle phid, unsigned char *data, int *dataLength, int *bitCount) |
int | CPhidgetIR_getLastLearnedCode (CPhidgetIRHandle phid, unsigned char *data, int *dataLength, CPhidgetIR_CodeInfo *codeInfo) |
int | CPhidgetIR_set_OnCode_Handler (CPhidgetIRHandle phid, int(*fptr)(CPhidgetIRHandle phid, void *userPtr, unsigned char *data, int dataLength, int bitCount, int repeat), void *userPtr) |
int | CPhidgetIR_set_OnLearn_Handler (CPhidgetIRHandle phid, int(*fptr)(CPhidgetIRHandle phid, void *userPtr, unsigned char *data, int dataLength, CPhidgetIR_CodeInfoHandle codeInfo), void *userPtr) |
int | CPhidgetIR_set_OnRawData_Handler (CPhidgetIRHandle phid, int(*fptr)(CPhidgetIRHandle phid, void *userPtr, int *data, int dataLength), void *userPtr) |
Detailed Description
These calls are specific to the Phidget IR object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.
Define Documentation
#define IR_MAX_CODE_BIT_COUNT 128 |
Maximum bit count for sent / received data
#define IR_MAX_CODE_DATA_LENGTH (IR_MAX_CODE_BIT_COUNT / 8) |
Maximum array size needed to hold the longest code
#define IR_MAX_REPEAT_LENGTH 26 |
Maximum array size for a repeat code
Typedef Documentation
The PhidgetIR CodeInfo structure contains all information needed to transmit a code, apart from the actual code data. Some values can be set to null to select defaults. See the product manual for more information.
Enumeration Type Documentation
The PhidgetIR supports these data encodings.
- Enumerator:
-
PHIDGET_IR_ENCODING_UNKNOWN |
Unknown - the default value |
PHIDGET_IR_ENCODING_SPACE |
Space encoding, or Pulse Distance Modulation |
PHIDGET_IR_ENCODING_PULSE |
Pulse encoding, or Pulse Width Modulation |
PHIDGET_IR_ENCODING_BIPHASE |
Bi-Phase, or Manchester encoding |
PHIDGET_IR_ENCODING_RC5 |
RC5 - a type of Bi-Phase encoding |
PHIDGET_IR_ENCODING_RC6 |
RC6 - a type of Bi-Phase encoding |
The PhidgetIR supports these encoding lengths
- Enumerator:
-
PHIDGET_IR_LENGTH_UNKNOWN |
Unknown - the default value |
PHIDGET_IR_LENGTH_CONSTANT |
Constant - the bitstream + gap length is constant |
PHIDGET_IR_LENGTH_VARIABLE |
Variable - the bitstream has a variable length with a constant gap |
Function Documentation
Creates a Phidget IR handle.
- Parameters:
-
| phid | A pointer to an unallocated Phidget IR handle. |
Transmits a code according to the settings in a CodeInto structure
- Parameters:
-
| phid | An attached phidget ir handle. |
| data | The code to send. Data is transmitted MSBit first. MSByte is in array index 0. LSBit is right justified, so MSBit may be in bit positions 0-7 in array index 0 depending on the bit count. |
| codeInfo | The CodeInfo structure specifying to to send the code. Anything left as null to select default is filled in for the user. |
Transmits a repeat of the last transmited code. Depending of the CodeInfo structure, this may be a retransmission of the code itself, or there may be a special repeat code.
- Parameters:
-
| phid | An attached phidget ir handle. |
int CPhidgetIR_TransmitRaw |
( |
CPhidgetIRHandle |
phid, |
|
|
int * |
data, |
|
|
int |
length, |
|
|
int |
carrierFrequency, |
|
|
int |
dutyCycle, |
|
|
int |
gap | |
|
) |
| | |
Transmits RAW data as a series of pulses and spaces.
- Parameters:
-
| phid | An attached phidget ir handle. |
| data | The data to send. The array must start and end with a pulse and each element is a positive time in us. |
| length | The length of the data array. Maximum length is 200, but streams should be kept much shorter, ie. < 100ms between gaps. |
| carrierFrequency | The Carrier Frequency in Hz. leave as 0 for default. |
| dutyCycle | The Duty Cycle (10-50). Leave as 0 for default. |
| gap | The gap time in us. This guarantees a gap time (no transmitting) after the data is sent, but can be set to 0. |
int CPhidgetIR_getRawData |
( |
CPhidgetIRHandle |
phid, |
|
|
int * |
data, |
|
|
int * |
dataLength | |
|
) |
| | |
Read any available raw data. This should be polled continuously (every 20ms) to avoid missing data. Read data always starts with a space and ends with a pulse.
- Parameters:
-
| phid | An attached phidget ir handle. |
| data | A user array for raw data to be written into. |
| dataLength | The maximum ammount of data to read. This is set to the actual ammount of data read. |
int CPhidgetIR_getLastCode |
( |
CPhidgetIRHandle |
phid, |
|
|
unsigned char * |
data, |
|
|
int * |
dataLength, |
|
|
int * |
bitCount | |
|
) |
| | |
Gets the last code that was received.
- Parameters:
-
| phid | An attached phidget ir handle. |
| data | A user array to store the code data in. |
| dataLength | Length of the user array - should be at least IR_MAX_CODE_DATA_LENGTH. This is set to the ammount of data actually written to the array. |
| bitCount | set to the bit count of the code. |
Gets the last code that was learned.
- Parameters:
-
| phid | An attached phidget ir handle. |
| data | A user array to store the code data in. |
| dataLength | Length of the user array - should be at least IR_MAX_CODE_DATA_LENGTH. This is set to the ammount of data actually written to the array. |
| codeInfo | The CodeInfo structure for the learned code. |
int CPhidgetIR_set_OnCode_Handler |
( |
CPhidgetIRHandle |
phid, |
|
|
int(*)(CPhidgetIRHandle phid, void *userPtr, unsigned char *data, int dataLength, int bitCount, int repeat) |
fptr, |
|
|
void * |
userPtr | |
|
) |
| | |
Set a Code handler. This is called when a code has been received that could be automatically decoded. Data is return as an array with MSB in index 0. Bit count and a repeat flag are also returned. Repeats are detected as either the same code repeated in < 100ms or as a special repeat code.
- Parameters:
-
| phid | An attached phidget ir handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Set a Learn handler. This is called when a code has been received for long enough to be learned. The returned CodeInfo structure can be used to retransmit the same code.
- Parameters:
-
| phid | An attached phidget ir handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |
Set a Raw Data handler. This is called when raw data has been read from the device. Raw data always starts with a space and ends with a pulse.
- Parameters:
-
| phid | An attached phidget ir handle. |
| fptr | Callback function pointer. |
| userPtr | A pointer for use by the user - this value is passed back into the callback function. |