Change tx power and frequency during program run using LoRawan and OTAA

I am now trying to build a fieldtester base on AS923 with heltec wifi lora 32V2. The fieldtester is now fully functional, it send an uplink in DR0 and a downlink payload with gatewayid,rssi and snr will be queued on the server-side. The device receive the downlink payload and it show the uplink rssi, snr for each gateway.

The problem is that a field tester should be able to send by different tx power(no need to above max, maybe 14db,10db) and frequency(such as 923.2, 923.4, 923.6, 923.8 Mhz), but I dont know how to modify the tx power and frequency in the main program. I found them in the AS923.h and i can change the tx power as well as the frequency by modify the setting on the .h file. Unlike the datarate, these value seems cant be changed in the main program, which means they cannot modify by user input. Any idea for this issue?

I found that the Heltec_ESP32 library have setTxPower() and setFrequency() function but it does not support OTAA. ESP32_LoRaWAN library support OTAA but doesn’t have the function mentioned above

Noticed that ADR must turned off and OTAA must be used.

Problem solved, i complete it by deeply look at the esp32 lorawan library and modify it