Device Communications Subroutines in the Enabler Sample

The CIMPLICITY Device Communications Toolkit API provides a customizable interface between CIMPLICITY software and device communications.

Following is a sample of how the user-customized subroutines fit into the overall execution of the enabler.

The order provided here represents a very high-level description of operation and includes only those details believed relevant to customizing an enabler.

INITIALIZATION
Setup internal data structures
????READ process configuration data for enabler
????READ port configuration data for enabler
????CALL user_init()
????...
????CALL user_open_port()
????CALL user_protocol_info();
????...
????FOREACH CIMPLICITY DEVICE related to this ENABLER
??????????READ CIMPLICITY configuration data for device
????????IF supported.use_default_domain_count == TOOLKIT_NO
????????????????CALL user_device_set_max_device_domain_count()
??????????ENDIF
?? ??CALL user_device_info()
??????????READ point configuration data for device
??????????IF supported.model_req == TOOLKIT_YES
??????????????CALL user_cpu_model()
??????????ENDIF
??????????FOREACH DEVICE_POINT
??????????????CALL user_valid_point()
??????????????IF problem with device or point and point was validated
??????????????????CALL user_remove_point()
??????????????ENDIF
??????????ENDFOR
??????????IF supported.det_dev_status == TOOLKIT_YES
??????????????CALL user_device_okay()
??????????ENDIF
????ENDFOR
????...
????COMPLETE INITIALIZATION BY ESTABLISHING COMMUNICATIONS
????WITH INTERESTED CIMPLICITY SUBSYSTEMS
????...
????WHEN
??????????UNSOLICITED_DATA_RECEIVED:
????????????????IF support.unsolic_req == TOOLKIT_YES
??????????????????????IF user_accept_unsolicited_data() returns TRUE
????????????????????????????CALL user_process_unsolicited_data()
??????????????????????ENDIF
????????????????ENDIF
??????????TIME_TO_SCAN_POINT_VALUES:
????????????????IF support.read_req == TOOLKIT_YES
??????????????????????SETUP parameters for read
??????????????????????CALL user_read_data()
??????????????????????CALL user_cvt_data_from_device()
????????????????ENDIF
??????????SET_POINT:
????????????????IF support.write_req == TOOLKIT_YES
??????????????????????SETUP parameters for write
??????????????????????CALL user_cvt_data_to_device()
??????????????????????CALL user_write_data()
????????????????ENDIF
??????????WRITE_POINT_QUALITY:
????????????????IF support.unsolicited_quality_data == TOOLKIT_YES
??????????????????????IF supported.extended_user_bits == TOOLKIT_YES
??????????????????????????????CALL user_write_point_quality2()
??????????????????????ELSE
???????????????????? ??????CALL user_write_point_quality()
??????????????????????ENDIF
????????????????ENDIF
??????????DEMAND_STATUS_UPDATE:
????????????????IF (point is no longer in demand)
??????????????????????CALL user_on_demand_response()
????????????????ELSE
??????????????????????CALL user_on_demand_response()
???????????? ??ENDIF
??????????TIME_TO_RETRY_FAILED_DEVICES:
????????????????FOREACH uninitialized device
????????????????????IF supported.use_default_domain_count == TOOLKIT_NO
????????????????????????????CALL user_device_set_max_device_domain_count()
??????????????????????CALL user_device_info()
??????????????????????IF supported.model_req == TOOLKIT_YES
????????????????????????????CALL user_cpu_model()
??????????????????????ENDIF
??????????????????????FOREACH DEVICE_POINT
????????????????????????????CALL user_valid_point()
??????????????????????ENDFOR
??????????????????????IF supported.det_dev_status == TOOLKIT_YES
????????????????????????????CALL user_device_okay()
??????????????????????ENDIF
????????????????ENDFOR
??????????NEW_POINT_DYNAMICALLY_CONFIGURED:
????????????????IF existing point
??????????????????????CALL user_remove_point()
????????????????CALL user_valid_point()
????????????????If not found valid
??????????????????????CALL user_remove_point()
????????????????IF poll-once point
??????????????????????CALL user_read_data()
??????????CHECK_DEVICE_STATUS:
????????????????IF ((support.host_redundancy == TOOLKIT_YES) &&
??????????????????????(currently secondary node))
??????????????????????CALL user_heartbeat_device
????????????????ENDIF
??????????SHUTDOWN:
????????????????Cleanup
????????????????CALL user_term()
??????????USER_EVENT_1:
????????????????CALL user_proc_event_1()
??????????USER_EVENT_2:
????????????????CALL user_proc_event_2()
??????????USER_EVENT_3:
????????????????CALL user_proc_event_3()
??????????USER_EVENT_4:
????????????????CALL user_proc_event_4()
??????????USER_EVENT_5:
????????????????CALL user_proc_event_5()
??????????USER_EVENT_6:
????????????????CALL user_proc_event_6()
??????????USER_EVENT_7:
????????????????CALL user_proc_event_7()
??????????USER_EVENT_8:
????????????????CALL user_proc_event_8()
??????????USER_EVENT_9:
????????????????CALL user_proc_event_9()
??????????USER_EVENT_10:
????????????????CALL user_proc_event_10()
????END WHEN