Px arming status detection

Hi all! I am developing an external system. I would like to ask you if there is a safe way to know if the flight controller IS armed or NOT.
Thank you very much in advance
Marco

In Hertbeat message have parameter: base_mode.
if((old_baseMode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY) != (heartbeatMessage.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY))
bool isArmed = heartbeatMessage.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY);