morcibacsi / PSAVanCanBridge

VAN - CAN protocol bridge (V2C) for cars made by PSA Group (Peugeot, Citroen)
GNU General Public License v3.0
111 stars 27 forks source link

New popup handler #2

Closed karolp1993 closed 4 years ago

karolp1993 commented 4 years ago

I've created new popup handler just like we talked. Major changes: All popups are visible with the same time. Popup with door open message is "monitoring" with every call of QueueNewMessage function. Item with type _CAN_POPUP_MSG_DOORS_BOOT_BONNET_REAR_SCREEN_AND_FUEL_TANKOPEN is showing when door status changes (with ShowCanPopupMessage method) and hiding when door status is equal 0. That's the reason I wanted to have item with door status all the time in QueueNewMessage. I made an assumption that we want to see messages with automatic lighting active and automatic locking active once per ignition and once per engine running, so I made additional logic to this. Another assumption is, we queue messages with the same type with certain period of time or we queue message if previous message was another type. I also wrote auxiliary function to push messages to queue, because three lines with semaphore and push to the queue was repeating often.