void notification::post_notification_msg(int32_t notification_type, uint64_t entity_id, uint16_t cmd_type, uint16_t desc_type, uint16_t desc_index, uint32_t cmd_status, void *notification_id) { uint32_t index; if((write_index - read_index) > NOTIFICATION_BUF_COUNT) { missed_notification_event_cnt++; return; } if(notification_type == NO_MATCH_FOUND || notification_type == END_STATION_CONNECTED || notification_type == END_STATION_DISCONNECTED || notification_type == COMMAND_TIMEOUT || notification_type == RESPONSE_RECEIVED || notification_type == END_STATION_READ_COMPLETED) { index = InterlockedExchangeAdd(&write_index, 1); notification_buf[index % NOTIFICATION_BUF_COUNT].notification_type = notification_type; notification_buf[index % NOTIFICATION_BUF_COUNT].entity_id = entity_id; notification_buf[index % NOTIFICATION_BUF_COUNT].cmd_type = cmd_type; notification_buf[index % NOTIFICATION_BUF_COUNT].desc_type = desc_type; notification_buf[index % NOTIFICATION_BUF_COUNT].desc_index = desc_index; notification_buf[index % NOTIFICATION_BUF_COUNT].cmd_status = cmd_status; notification_buf[index % NOTIFICATION_BUF_COUNT].notification_id = notification_id; post_notification_event(); } }
notification_imp::~notification_imp() { post_notification_event(); sem_unlink("/notify_waiting_sem"); }