public void HandleAggregatedStatusListUpdate(cRoadSideObject RoadSideObject, cAggregatedStatusEvent AggregatedStatusEvent)
 {
     if (SelectedRoadSideObject == RoadSideObject)
     {
         for (int iIndex = 0; iIndex < RoadSideObject.bBitStatus.GetLength(0); iIndex++)
         {
             SetStatusBitColor(listView_AggregatedStatus_StatusBits.Items[iIndex], RoadSideObject.bBitStatus[iIndex]);
         }
     }
     AddAggregatedStatusEventToList(RoadSideObject, AggregatedStatusEvent);
 }
        private bool DecodeAndParseAggregatedStatusMessage(RSMP_Messages.Header packetHeader, string sJSon, bool bUseStrictProtocolAnalysis, bool bUseCaseSensitiveIds, ref bool bHasSentAckOrNack, ref string sError)
        {
            StringComparison sc = bUseCaseSensitiveIds ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;

            bool bSuccess = false;

            try
            {
                RSMP_Messages.AggregatedStatus AggregatedStatus = JSonSerializer.Deserialize <RSMP_Messages.AggregatedStatus>(sJSon);

                cRoadSideObject RoadSideObject = cHelper.FindRoadSideObject(AggregatedStatus.ntsOId, AggregatedStatus.cId, bUseCaseSensitiveIds);

                if (RoadSideObject != null)
                {
                    RoadSideObject.bBitStatus          = AggregatedStatus.se;
                    RoadSideObject.sFunctionalPosition = AggregatedStatus.fP;
                    RoadSideObject.sFunctionalState    = AggregatedStatus.fS;
                    cAggregatedStatusEvent AggregatedStatusEvent = new cAggregatedStatusEvent();
                    AggregatedStatusEvent.sTimeStamp          = UnpackISO8601UTCTimeStamp(AggregatedStatus.aSTS);
                    AggregatedStatusEvent.sMessageId          = AggregatedStatus.mId;
                    AggregatedStatusEvent.sFunctionalPosition = AggregatedStatus.fP;
                    AggregatedStatusEvent.sFunctionalState    = AggregatedStatus.fS;

                    for (int i = 1; i < AggregatedStatus.se.Length + 1; i++)
                    {
                        AggregatedStatusEvent.sBitStatus += "B" + i + ": " + AggregatedStatus.se[i - 1] + " | ";
                    }
                    AggregatedStatusEvent.sBitStatus.Trim();

                    if (RSMPGS_Main.bWriteEventsContinous)
                    {
                        RSMPGS.SysLog.EventLog("AggregatedStatus;{0}\tMId: {1}\tComponentId: {2}\tBitStatus: {3}\tFuncPos: {4}\tFunkState: {5}",
                                               AggregatedStatusEvent.sTimeStamp, AggregatedStatusEvent.sMessageId, AggregatedStatus.cId, AggregatedStatusEvent.sBitStatus,
                                               AggregatedStatusEvent.sFunctionalPosition, AggregatedStatusEvent.sFunctionalState);
                    }

                    RoadSideObject.AggregatedStatusEvents.Add(AggregatedStatusEvent);
                    RSMPGS.MainForm.HandleAggregatedStatusListUpdate(RoadSideObject, AggregatedStatusEvent);
                    bSuccess = true;
                }
                if (bSuccess == false)
                {
                    sError = "Failed to update AggregatedStatus, could not find object, ntsOId: '" + AggregatedStatus.ntsOId + "', cId: '" + AggregatedStatus.cId + "'";
                }
            }
            catch (Exception e)
            {
                sError   = "Failed to deserialize packet: " + e.Message;
                bSuccess = false;
            }

            return(bSuccess);
        }
        private void AddAggregatedStatusEventToList(cRoadSideObject RoadSideObject, cAggregatedStatusEvent AggregatedStatusEvent)
        {
            if (bIsUpdatingAggregatedStatusEventList == false)
            {
                listView_AggregatedStatusEvents.StopSorting();
                listView_AggregatedStatusEvents.BeginUpdate();
                bIsUpdatingAggregatedStatusEventList = true;
            }

            ListViewItem lvItem = listView_AggregatedStatusEvents.Items.Add(AggregatedStatusEvent.sTimeStamp.ToString());

            lvItem.SubItems.Add(AggregatedStatusEvent.sMessageId);
            lvItem.SubItems.Add(AggregatedStatusEvent.sBitStatus);
            lvItem.SubItems.Add(AggregatedStatusEvent.sFunctionalPosition);
            lvItem.SubItems.Add(AggregatedStatusEvent.sFunctionalState);
        }