how to get txPower to calculate distance from RSSI

QBluetoothServiceDiscoveryAgent serviceInfo; quint i =serviceInfo.device().rssi();
here i = 43
how to convert it to distance? I got the link Understanding ibeacon distancing but how to get the transmitter power? to calculate the distance according to formula?
int ratio_db = txCalibratedPower  rssi;
int ratio_linear = Math.pow(10, ratio_db / 10);int distance = Math.sqrt(ratio_linear);

Test it... as javascript ... :)
http://www.metageek.com/training/resources/understandingrssi.html
function calculateDistance(rssi) { var txPower = 59 //hard coded power value. Usually ranges between 59 to 65 if (rssi == 0) { return 1.0; } var ratio = rssi*1.0/txPower; if (ratio < 1.0) { return Math.pow(ratio,10); } else { var distance = (0.89976)*Math.pow(ratio,7.7095) + 0.111; return distance; } }