gsmdecode.py support integration
[ussd-widget] / ussd-common / src / usr / bin / ussdquery.py
index c67de52..7785511 100755 (executable)
@@ -10,6 +10,7 @@ import pexpect
 import time
 from subprocess import *
 import sys
+import gsmdecode
 
 if len(sys.argv) != 2:
     print "Usage: ussdquery.py <ussd number>"
@@ -37,14 +38,8 @@ encoding = replystring[end+2:].strip();
 
 child.sendeof();
 
-# Check if we need to decode answer
-# Compressed messages are not supported yet
-if encoding == '86':
-    reply = reply.decode("hex")
-elif encoding == '72':
-    reply = reply.decode("hex")
-    p = Popen(['iconv', '-f', 'UCS-2BE', '-t', 'UTF8'], stdin=PIPE, stdout=PIPE);
-    reply = p.communicate(reply)[0]
+# Decoding ansver
+reply = gsmdecode.decode(reply, int(encoding))
 
 print reply;