What is the purpose of the txPower in a Beacon? According to this, How to set Transmitting Speed vs Scanning Speeds for Altbeacon Library, the maximum transmission power is already set by default.
Then what is the meaning of the txPower that can be set when sending the beacon and what are the possible values for it?
The txPower field sets one of the bytes in the over the air beacon advertisement. It indicates what a receiving device should expect the signal strength in RSSI to be when the beacon transmitter is one meter away.
A receiving device can then compare the txPower value to the actual measured signal strength and if it is stronger, that means the beacon is closer than one meter. If it is weaker then the beacon is farther than one meter. These two values (actual signal strength vs txPower) can be plugged in to a formula to get a rough distance estimate.
The reason this is a configurable field in the advertisement is twofold:
Not all transmitters have the same output power, so for best results the value should be set on a per device basis. (In practice this is rarely done.)
Obstructions and reflections of the radio signal can impact the expected signal strength at the receiver. For example, a beacon is installed under a counter or in a cabinet. For this reason, measuring the signal after installation (calibration) is recommended for best results.
The default txPower field for the iPhone 4s (the first phone supporting iBeacon for both reception and transmission.) was -59 dBm. This is fairly typical of mobile phones built since then and dedicated transmitters at the full power allowed by regulatory agencies. But variations of 5dB on specific device models are not uncommon.
Read more in my blog post here: http://www.davidgyoungtech.com/2020/05/15/how-far-can-you-go