User Defined Tone Alarm for Message Acknowledgement

Hello All,

I am trying to have my Pixhawk play a custom tune when it receives a bluetooth message from the Android App I made.

So far I have only been able to modify the already existing tunes by modifying the ToneAlarm.cpp file. In this file there is a write method that takes (file *filp, const char buffer, size_t len) as its arguments. It checks the char buffer and if it is not null it copies buffer into user_tune then plays user tune.

However, I am pretty new to C++ and have been unable to get a tune to play. I have this code after a bluetoooth message is decoded:

     const char *user_tune =  "MBT140 L2O4B L4O5D L2O4A L8GA L2B L4O5D L1O4A L2B L4O5D L2A L4G L2D L8CO4B L1A"; //plays Lullaby
    int _tone_alarm_fd = open(TONEALARM0_DEVICE_PATH, O_WRONLY);
    ::write(_tone_alarm_fd, &user_tune, sizeof(user_tune));

I found the format for the above in GPIO.cpp, however the ::write() line was commented out.I import all the clases this class imports as well.

Does anyone have any idea why this ::write() method is not working?

If anyone could help me out here I would greatly appreciate it.