123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #include "plt.h"
- #include "mdl.h"
- void mdl_sim()
- {
- }
- void mdl_prepare()
- {
- MDL.smoke_alarm = 0;
- MDL.switch_statu = 0;
- MDL.temperature_alarm = 0;
- MDL.press_low_alarm = 0;
- }
- void from_modbus_to_dev()
- {
- //usHoldingRegisters[0x6020] = uab;
-
- return 0;
- }
- int from_dev_to_modbus()
- {
- // uab = usHoldingRegisters[0x6020];
-
- return 0;
- }
- void update_states()
- {
- }
- static void *mdl_thrd_main(void *param)
- {
- mdl_prepare();
- from_dev_to_modbus();
- while (1)
- {
- from_modbus_to_dev();
- mdl_sim();
- from_dev_to_modbus();
- usleep(10000); /* 10ms */
- }
- return NULL;
- }
- int mdl_init()
- {
- log_dbg("%s, ++", __func__);
- int ret = 0;
- pthread_t xthrd;
- if (pthread_create(&xthrd, NULL, mdl_thrd_main, NULL) != 0)
- {
- log_dbg("%s, pthread_create fail", __func__);
- ret = -1;
- }
- log_dbg("%s, --, ret: %d", __func__, ret);
- return ret;
- }
|