The UK NHS has just released the Android and iOS source code for the UK NHS Covid-19 contact tracking app. This is the code used before the recent switch to the Google/Apple mechanism.
The iOS readme explains how it works:
Our unique identifier is also known as our service characteristic. In the Bluetooth spec, devices can broadcast the availability of services. Each service can have multiple characteristics. We use a characteristic to uniquely identify our service and distinguish from all other sorts of Bluetooth devices. For every device we find with a matching characteristic, we record an identifier for the device we saw, the timestamp, and the RSSI of the Bluetooth signal, which will allow a team later on to determine who was in close proximity to individuals infected with the novel coronavirus