Go to the documentation of this file.00001
00021 #ifndef CP1616_IO_CONTROLLER_CALLBACKS_CPP
00022 #define CP1616_IO_CONTROLLER_CALLBACKS_CPP
00023
00024 #include <cp1616/cp1616_io_controller.h>
00025
00026 namespace cp1616
00027 {
00028 namespace pnio_controller_callbacks
00029 {
00030 void modeChangeIndication(PNIO_CBE_PRM *p_cbf_prm)
00031 {
00032
00033 Cp1616IOController *CallbackHandler = Cp1616IOController::getControllerInstance();
00034
00035 if(p_cbf_prm->CbeType == PNIO_CBE_MODE_IND)
00036 {
00037 switch (p_cbf_prm->ModeInd.Mode)
00038 {
00039 case PNIO_MODE_OFFLINE:
00040 ROS_INFO_STREAM("IO_controller mode change request-> OFFLINE: ");
00041 CallbackHandler->setCpCurrentModeFlag(PNIO_MODE_OFFLINE);
00042 break;
00043 case PNIO_MODE_CLEAR:
00044 ROS_INFO_STREAM("IO_controller mode change request-> CLEAR: ");
00045 CallbackHandler->setCpCurrentModeFlag(PNIO_MODE_CLEAR);
00046 break;
00047 case PNIO_MODE_OPERATE:
00048 ROS_INFO_STREAM("IO_controller mode change request-> OPERATE: ");
00049 CallbackHandler->setCpCurrentModeFlag(PNIO_MODE_OPERATE);
00050 break;
00051 default:
00052 ROS_INFO_STREAM("Not able to change IO_controller mode: Wrong mode selected!");
00053 break;
00054 };
00055
00056
00057 CallbackHandler->setSemModChange(1);
00058 }
00059 }
00060
00061 void alarmIndication(PNIO_CBE_PRM *p_cbf_prm)
00062 {
00063
00064 Cp1616IOController *CallbackHandler = Cp1616IOController::getControllerInstance();
00065
00066 if(p_cbf_prm->CbeType==PNIO_CBE_ALARM_IND)
00067 {
00068 switch (p_cbf_prm->AlarmInd.pAlarmData->AlarmType)
00069 {
00070 case PNIO_ALARM_DIAGNOSTIC:
00071 ROS_WARN_STREAM("PNIO_ALARM_DIAGNOSTIC");
00072 break;
00073 case PNIO_ALARM_PROCESS:
00074 ROS_WARN_STREAM("PNIO_ALARM_DIAGNOSTIC");
00075 break;
00076 case PNIO_ALARM_PULL:
00077 ROS_WARN_STREAM("PNIO_ALARM_PULL");
00078 break;
00079 case PNIO_ALARM_PLUG:
00080 ROS_WARN_STREAM("PNIO_ALARM_PLUG");
00081 break;
00082 case PNIO_ALARM_STATUS:
00083 ROS_WARN_STREAM("PNIO_ALARM_STATUS");
00084 break;
00085 case PNIO_ALARM_UPDATE:
00086 ROS_WARN_STREAM("PNIO_ALARM_UPDATE");
00087 break;
00088 case PNIO_ALARM_REDUNDANCY:
00089 ROS_WARN_STREAM("PNIO_ALARM_REDUNDANCY");
00090 break;
00091 case PNIO_ALARM_CONTROLLED_BY_SUPERVISOR:
00092 ROS_WARN_STREAM("PNIO_ALARM_CONTROLLED_BY_SUPERVISOR");
00093 break;
00094 case PNIO_ALARM_RELEASED_BY_SUPERVISOR:
00095 ROS_WARN_STREAM("PNIO_ALARM_RELEASED_BY_SUPERVISOR");
00096 break;
00097 case PNIO_ALARM_PLUG_WRONG:
00098 ROS_WARN_STREAM("PNIO_ALARM_PLUG_WRONG");
00099 break;
00100 case PNIO_ALARM_RETURN_OF_SUBMODULE:
00101 ROS_WARN_STREAM("PNIO_ALARM_RETURN_OF_SUBMODULE");
00102 break;
00103 case PNIO_ALARM_DEV_FAILURE:
00104 #if DEBUG
00105 ROS_WARN_STREAM("PNIO_ALARM_DEV_FAILURE");
00106 #endif
00107 break;
00108 case PNIO_ALARM_DEV_RETURN:
00109 #ifdef DEBUG
00110 ROS_WARN_STREAM("PNIO_ALARM_DEV_RETURN");
00111 #endif
00112 CallbackHandler->setCpReady(1);
00113 break;
00114 default:
00115 ROS_WARN_STREAM("callback_for_alarm_indication called with wrong type");
00116 break;
00117 };
00118 }
00119 }
00120
00121 void deviceActivation(PNIO_CBE_PRM *p_cbf_prm)
00122 {
00123 switch( p_cbf_prm->DevActConf.Mode)
00124 {
00125 case PNIO_DA_TRUE:
00126 ROS_INFO("IO_Controller - address %x was activated with result %x",
00127 (int)p_cbf_prm->DevActConf.pAddr->u.Addr,
00128 (int)p_cbf_prm->DevActConf.Result);
00129 break;
00130 case PNIO_DA_FALSE:
00131 ROS_INFO("IO_Controller - address %x was deactivated with result %x",
00132 (int)p_cbf_prm->DevActConf.pAddr->u.Addr,
00133 (int)p_cbf_prm->DevActConf.Result);
00134 break;
00135 };
00136 }
00137
00138 void dsReadConf(PNIO_CBE_PRM *p_cbf_prm)
00139 {
00140 ROS_WARN_STREAM("CallbackForDsReadConf should not occur within this implementation");
00141 }
00142
00143 void dsWriteConf(PNIO_CBE_PRM *p_cbf_prm)
00144 {
00145 ROS_WARN_STREAM("CallbackForDsWriteConf should not occur within this implementation");
00146 }
00147 }
00148 }
00149
00150 #endif //CP1616_IO_CONTROLLER_CALLBACKS_CPP