35 printf("%s %10d detached!\n", name, serialNo); |
35 printf("%s %10d detached!\n", name, serialNo); |
36 |
36 |
37 return 0; |
37 return 0; |
38 } |
38 } |
39 |
39 |
40 int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown) |
40 int ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown) |
41 { |
41 { |
42 printf("Error handled. %d - %s", ErrorCode, unknown); |
42 printf("Error handled. %d - %s", ErrorCode, unknown); |
43 return 0; |
43 return 0; |
44 } |
44 } |
45 |
45 |
46 //callback that will run if an input changes. |
46 //callback that will run if an input changes. |
47 //Index - Index of the input that generated the event, State - boolean (0 or 1) representing the input state (on or off) |
47 //Index - Index of the input that generated the event, State - boolean (0 or 1) representing the input state (on or off) |
48 int CCONV InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State) |
48 int InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State) |
49 { |
49 { |
50 printf("Digital Input: %d > State: %d\n", Index, State); |
50 printf("Digital Input: %d > State: %d\n", Index, State); |
51 return 0; |
51 return 0; |
52 } |
52 } |
53 |
53 |
54 //callback that will run if an output changes. |
54 //callback that will run if an output changes. |
55 //Index - Index of the output that generated the event, State - boolean (0 or 1) representing the output state (on or off) |
55 //Index - Index of the output that generated the event, State - boolean (0 or 1) representing the output state (on or off) |
56 int CCONV OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State) |
56 int OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State) |
57 { |
57 { |
58 printf("Digital Output: %d > State: %d\n", Index, State); |
58 printf("Digital Output: %d > State: %d\n", Index, State); |
59 return 0; |
59 return 0; |
60 } |
60 } |
61 |
61 |
62 //callback that will run if the sensor value changes by more than the OnSensorChange trigger. |
62 //callback that will run if the sensor value changes by more than the OnSensorChange trigger. |
63 //Index - Index of the sensor that generated the event, Value - the sensor read value |
63 //Index - Index of the sensor that generated the event, Value - the sensor read value |
64 int CCONV SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value) |
64 int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value) |
65 { |
65 { |
66 printf("Sensor: %d > Value: %d\n", Index, Value); |
66 printf("Sensor: %d > Value: %d\n", Index, Value); |
67 return 0; |
67 return 0; |
68 } |
68 } |
69 |
69 |