ir.cpp
Go to the documentation of this file.
1 #include "phidgets_api/ir.h"
2 
3 #include <cstdio>
4 
5 namespace phidgets {
6 
7 IR::IR() : Phidget(), ir_handle_(nullptr)
8 {
9  // create the handle
10  CPhidgetIR_create(&ir_handle_);
11 
12  // pass handle to base class
13  Phidget::init((CPhidgetHandle)ir_handle_);
14 
15  // register base class callbacks
17 
18  // register ir data callback
19  CPhidgetIR_set_OnCode_Handler(ir_handle_, CodeHandler, this);
20 }
21 
23 {
24 }
25 
26 int IR::CodeHandler(CPhidgetIRHandle /* ir */, void *userptr,
27  unsigned char *data, int dataLength, int bitCount,
28  int repeat)
29 {
30  ((IR *)userptr)->codeHandler(data, dataLength, bitCount, repeat);
31  return 0;
32 }
33 
34 void IR::codeHandler(unsigned char * /* data */, int /* dataLength */,
35  int /* bitCount */, int /* repeat */)
36 {
37  // This method can be overridden in a concrete subclass (e.g., ROS wrapper)
38 }
39 
40 } // namespace phidgets
virtual void codeHandler(unsigned char *data, int dataLength, int bitCount, int repeat)
Definition: ir.cpp:34
virtual ~IR()
Definition: ir.cpp:22
void registerHandlers()
Definition: phidget.cpp:17
Definition: ir.h:8
static int CodeHandler(CPhidgetIRHandle ir, void *userPtr, unsigned char *data, int dataLength, int bitCount, int repeat)
Definition: ir.cpp:26
IR()
Definition: ir.cpp:7
void init(CPhidgetHandle handle)
Definition: phidget.cpp:24
CPhidgetIRHandle ir_handle_
Definition: ir.h:20


phidgets_api
Author(s): Tully Foote, Ivan Dryanovski
autogenerated on Fri Apr 9 2021 02:56:02