0003 — Device memory names¶
The access synchronization API names panel memory device memory. A position in device memory is where the
panel stores one record (a user, a card, a time schedule). The old names are [Obsolete] warnings: an adapter
that still uses them builds and behaves the same. One case is a build error: an override of the generated
{Type}AddressRange property on AccessDifferConfig.
| Old name | New name |
|---|---|
GetReservedAddresses(string typeId) |
GetReservedDeviceMemory(string typeId) |
ClearDeviceMemory(IReadOnlyList<OccupiedSlotGroup> occupiedSlotGroups, bool initialCleanup) |
ClearDeviceMemory(IReadOnlyList<OccupiedDeviceMemory> occupied, bool initialCleanup) |
OccupiedSlotGroup.Slots |
OccupiedDeviceMemory.Positions |
AddressRange (generated record struct) |
DeviceMemoryRange |
AccessDifferConfig.{Type}AddressRange |
AccessDifferConfig.{Type}MemoryRange |
Stored data keeps its names: AddressMapping, AddressMapping.DeviceAddress and the address: uint entity
property in access-model.yaml do not change.
How the old names keep working¶
- The framework calls
GetReservedDeviceMemory. Its default callsGetReservedAddresses, so an old override still reserves its positions. - The framework calls the
OccupiedDeviceMemoryoverload ofClearDeviceMemory. Its default converts the list and calls theOccupiedSlotGroupoverload, so an old override still clears the panel. AddressRangeconverts to and fromDeviceMemoryRangeimplicitly, so code that reads a range still builds.{Type}AddressRangereturns{Type}MemoryRange. It is no longer virtual, so an override of it fails to build.
Fix the warnings¶
Step 1 — Rename the overrides¶
| Change this | To this |
|---|---|
protected override IEnumerable<uint> GetReservedAddresses(string typeId) |
protected override IEnumerable<uint> GetReservedDeviceMemory(string typeId) |
protected override IEnumerable<IProtocolCommand> ClearDeviceMemory(IReadOnlyList<OccupiedSlotGroup> occupiedSlotGroups, bool initialCleanup) |
protected override IEnumerable<IProtocolCommand> ClearDeviceMemory(IReadOnlyList<OccupiedDeviceMemory> occupied, bool initialCleanup) |
Inside ClearDeviceMemory, read group.Positions instead of group.Slots.
Step 2 — Rename range uses¶
| Change this | To this |
|---|---|
AddressRange |
DeviceMemoryRange |
config.UserAddressRange |
config.UserMemoryRange |
public override AddressRange UserAddressRange => ... |
public override DeviceMemoryRange UserMemoryRange => ... |
Step 3 — Verify¶
Build the adapter. The build shows no CS0618 or CS0672 warning that names one of the old members.