Created
September 22, 2022 13:03
-
-
Save justingreerbbi/5146f5c07e8f24d0e9f315e4b3eaf080 to your computer and use it in GitHub Desktop.
PHP M2M CSQ Command Convert to dB and Signal Status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Breakdown of the RSSI return for AT+CSQ command. The return from the command gives a value that needs to be | |
* converted in many instances. | |
* | |
* @link https://m2msupport.net/m2msupport/atcsq-signal-quality/ | |
*/ | |
$values = array( | |
'2' => array( | |
'dB' => '-109', | |
'condition' => 'Marginal' | |
), | |
'3' => array( | |
'dB' => '-107', | |
'condition' => 'Marginal' | |
), | |
'4' => array( | |
'dB' => '-105', | |
'condition' => 'Marginal' | |
), | |
'5' => array( | |
'dB' => '-103', | |
'condition' => 'Marginal' | |
), | |
'6' => array( | |
'dB' => '-101', | |
'condition' => 'Marginal' | |
), | |
'7' => array( | |
'dB' => '-99', | |
'condition' => 'Marginal' | |
), | |
'8' => array( | |
'dB' => '-97', | |
'condition' => 'Marginal' | |
), | |
'9' => array( | |
'dB' => '-95', | |
'condition' => 'Marginal' | |
), | |
'10' => array( | |
'dB' => '-93', | |
'condition' => 'OK' | |
), | |
'11' => array( | |
'dB' => '-91', | |
'condition' => 'OK' | |
), | |
'12' => array( | |
'dB' => '-89', | |
'condition' => 'OK' | |
), | |
'13' => array( | |
'dB' => '-87', | |
'condition' => 'OK' | |
), | |
'14' => array( | |
'dB' => '-85', | |
'condition' => 'OK' | |
), | |
'15' => array( | |
'dB' => '-83', | |
'condition' => 'Good' | |
), | |
'16' => array( | |
'dB' => '-81', | |
'condition' => 'Good' | |
), | |
'17' => array( | |
'dB' => '-79', | |
'condition' => 'Good' | |
), | |
'18' => array( | |
'dB' => '-77', | |
'condition' => 'Good' | |
), | |
'19' => array( | |
'dB' => '-75', | |
'condition' => 'Good' | |
), | |
'20' => array( | |
'dB' => '-73', | |
'condition' => 'Excellent' | |
), | |
'21' => array( | |
'dB' => '-71', | |
'condition' => 'Excellent' | |
), | |
'22' => array( | |
'dB' => '-69', | |
'condition' => 'Excellent' | |
), | |
'23' => array( | |
'dB' => '-67', | |
'condition' => 'Excellent' | |
), | |
'24' => array( | |
'dB' => '-65', | |
'condition' => 'Excellent' | |
), | |
'25' => array( | |
'dB' => '-63', | |
'condition' => 'Excellent' | |
), | |
'26' => array( | |
'dB' => '-61', | |
'condition' => 'Excellent' | |
), | |
'27' => array( | |
'dB' => '-59', | |
'condition' => 'Excellent' | |
), | |
'28' => array( | |
'dB' => '-57', | |
'condition' => 'Excellent' | |
), | |
'29' => array( | |
'dB' => '-55', | |
'condition' => 'Excellent' | |
), | |
'30' => array( | |
'dB' => '-53', | |
'condition' => 'Excellent' | |
), | |
); | |
$rssi = 18; // Device RSSI value | |
$return = $values[ $rssi ]; // Grab the proper array containing the dB and signal condition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment