I am attempting to create a peripheral device with the Argon which is compliant with Apple’s guidelines. One of the requirements is Tx Power Level. In the Argon reference, it shows TX_POWER_LEVEL under the BleAdvertisingDataType section. To my limited understanding, I think it be be implemented the following way, but doesn’t seem to work:
In what way does it not work?
Do you get a compile error?
If so, which?
How much other data have you got in your advertising data?
Can you show all/more of your code?
Thank you! Like I said, I’m new to particle, so I’m not sure I would have figured that out. However, that solved my compiling issue. I can now see that global variable. That being said, do you know how I can update that with the actual value?
First we’d need to establish if this value is actually updated in the advertised data when the variable changes.
Since it’s a global variable you can do that from any function (e.g. loop()) like this
void loop() {
pwrLevel -= -5;
delay(1000);
}
this would decrease the advertised value by 5 every second.
How to acquire the actual transmission power from the system I don’t know either
That’s something I’d think @eugene0501 would be able to comment on.
The TX power you set in the advertising data should be the same as the actual TX power the device currently applying. The BLE.txPower(int8_t* txPower) API will return the actual TX power for you. And then you can call the advData.append(BleAdvertisingDataType::TX_POWER_LEVEL, ...) to insert it to the BLE advertising data object and call BLE.setAdvertisingData() to update the advertising data.