private void UpdateDeviceCatalogue(object stateInfo) { CANFrame frame = (CANFrame)stateInfo; DeviceCatalogueInfo dci = frame.ToDeviceCatalogueInfo(); if (dci == null) { return; } CNXLog.InfoFormat("DeviceCataloge {0}", dci.ToString()); DeviceCatalogue.CatalogueChangeType catalogeUpdated = mDeviceCatalogue.UpdateDeviceCatalogue(dci); if (catalogeUpdated != DeviceCatalogue.CatalogueChangeType.NONE) { CNXLog.InfoFormat("DeviceCataloge Updating calalogue."); if (catalogeUpdated == DeviceCatalogue.CatalogueChangeType.EQUIPMENT) { // persist the catalogue PersistCatalogue(); } EquipmentChangedEventArgs a = new EquipmentChangedEventArgs(mDeviceCatalogue.EquipmentMask, mDeviceCatalogue.EquipmentStatus); OnRaiseEquipmentChangedEvent(a); } }
/// <summary> /// Updates the BuildNo, Mask and Status. /// </summary> /// <param name="info">Device details to update this device to.</param> /// <returns>True if any data was changed, false if no fields needed updating.</returns> /// <remarks> /// The Status information is staged to allow for any gitter. /// Use the <see cref="PulseAlive"/> method to propogate the Status to the public interface. /// </remarks> public DeviceCatalogue.CatalogueChangeType Update(DeviceCatalogueInfo info) { DeviceCatalogue.CatalogueChangeType ret = DeviceCatalogue.CatalogueChangeType.NONE; lock (this) { if (mBuildNo != info.mBuildNo || mMask != info.mMask) { mBuildNo = info.BuildNo; mMask |= info.mMask; ret = DeviceCatalogue.CatalogueChangeType.EQUIPMENT; } mPendingStatus |= info.mStatus; } return(ret); }