I have been searching for this for long long time now, but failed drastically to find any tips. Your help is very much appreciated.
I am using ArduinoBLE Library on Arduino Nano 33 IoT.
There is no method to setTxPower() in it. I need to lower the transmission power to limit the BLE advertising range within 2 to 3 meters.
Some people suggested using setManufacturerData() method in the same library. However, I have no clue what data to write in it, or even if the transmission power can be changed like that way in the first place.
You need to define a Gatt Service for this and that is possible using ArduinoBLE.
Suggest looking at the BatteryMonitor example for guidance. The standard UUID you need to use for Tx Power is 0x1804. Just swap out the Battery Voltage one for this one.
Then within this service is a standard characteristic defined as "Tx Power Level" This is a predefined Uuid of 0x2A07.
This is how you parse out the data for that characteristic:
NOTE: This just deals with communicating the TX power and not setting it. I tried to find a set TX power option in the ArduinoBLE library and, as you right say, there does not appear to be anything available. I think you have an additional problem too with the Arduino Nano 33 IoT board as the SAMD chip is doing the library "interpreting" which in turn communicates to the ublox chip. So you could not merely amend the ArduinoBLE library to suit.
I did some quick digging and based on what I found (not comprehensive mind you) it looks like it'a not possible to change the TX power at all. This has nothing to do with the ArduinoBLE but is in fact related to the firmware on wifi/ble (esp32) chip itself.
So, if this is important to you, I would suggest you purchase a non esp32-based BLE board.
It should be theoretically possible with the Arduino nano 33 BLE board but you'd have to do it outside the ArduinoBLE library via a Nordic SDK command for the nRF25840. Not sure how to do that though.