atmodem: added inline function to parse AT+CESQ result for signal strenght It complements the function at_util_convert_signal_strength for AT+CSQ, which does not apply well to 3G and not at all to LTE. The AT+CESQ returns 3 sets of values, one for each technology (2G, 3G, LTE).
PATCH 1/1 atmodem: added inline function to parse AT+CESQ result for signal strenght It complements the function at_util_convert_signal_strength for AT+CSQ, which does not apply well to 3G and not at all to LTE. The AT+CESQ returns 3 sets of values, one for each technology (2G, 3G, LTE).
--- drivers/atmodem/atutil.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/atmodem/atutil.h +14 -0
@@ -115,6 +115,20 @@ static inline int at_util_convert_signal_strength(int strength)return result; } +static inline int at_util_convert_signal_strength_cesq (int strength_GSM,int strength_UTRAN,int strength_EUTRAN) +{ +int result =-1 ; + +if (strength_GSM !=99 ) + result = (strength_GSM *100 ) /63 ; +else if (strength_UTRAN !=255 ) + result = (strength_UTRAN *100 ) /96 ; +else if (strength_EUTRAN !=255 ) + result = (strength_EUTRAN *100 ) /97 ; + +return result; +} + #define CALLBACK_WITH_FAILURE(cb, args...) \ do { \ struct ofono_error cb_e; \
Signature · 1 line
1.9.1
Hi Giacinto,
So just to make sure:
- Your commit header should be no longer than 50 characters
Your commit description can be as long as you need, but broken down into 72 character wide lines.
It looks like your description is included in the header. I can't apply this :)
drivers/atmodem/atutil.h static inline int at_util_convert_signal_strength(int strength) · line 118
Quoted 13 lines · Giacinto Cifelli
--- drivers/atmodem/atutil.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/atmodem/atutil.h +1
-0@@ -115,6 +115,20 @@ static inline int at_util_convert_signal_strength(int strength)return result; } +static inline int at_util_convert_signal_strength_cesq (int strength_GSM,int strength_UTRAN,int strength_EUTRAN)
doc/coding-style.txt item M4.
Quoted 7 lines
drivers/atmodem/atutil.h +6
-0+{ +int result =-1 ; + +if (strength_GSM !=99 ) + result = (strength_GSM *100 ) /63 ; +else if (strength_UTRAN !=255 )
drivers/atmodem/atutil.h static inline int at_util_convert_signal_strength(int strength) · line 134
Quoted 10 lines
drivers/atmodem/atutil.h +7
-0+ result = (strength_UTRAN *100 ) /96 ; + else if (strength_EUTRAN != 255) + result = (strength_EUTRAN *100 ) /97 ; + +return result; +} + #define CALLBACK_WITH_FAILURE(cb, args...) \ do { \ struct ofono_error cb_e; \
Regards,
-Denis