faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
384 stars 302 forks source link

sendUssd encoding/decoding issues #26

Open lopesandre opened 10 years ago

lopesandre commented 10 years ago

Hi,

To send a Ussd to see the balance I do:

modem.sendUssd('AA514C361B01') # 'AA514C361B01' translates to '*#123#'

This will return s tring in the same format. How can I translate to human readable text?

Any ideas?

Best Regards,

BOOMER74 commented 10 years ago

Try this: response = iter(gsmmodem.pdu.toByteArray(gsmmodem.modem.sendUssd(request).message)) result = unicode(gsmmodem.pdu.decodeUcs2(response, response))

request in my case is "*102#".

faucamp commented 10 years ago

Is this a Huawei modem? Please see 0c59976c93b946a84f027867d4408aa9be3acbe9 - this enables text-mode USSD on some Huawei modems (but I would assume not all).