481
What's New / Re: ScriptBasic for Android
« on: May 14, 2012, 08:44:47 PM »
The million dollar question is what is the IP to use in scriba?
Forum Registration Disabled - Send a request to support@scriptbasic.org to join the forum.
User Guide
Developers Guide
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

PRINT #1,"{id:1,method:notify,params:[\"ScriptBasic\",\"The message for the notification\"]}"
PRINT #1,"""{"id":1,"method":"notify","params":["ScriptBasic","The message for the notification"]}\n"""

' Android SL4A Interface
'
' ScriptBasic Open Source Project
'
' Contributors:
' John Spikowski (JRS)
'
' Change Log:
' 20120513 - Initial module created
MODULE DVM
OPEN "localhost:9999" FOR SOCKET AS #1
id = 1
FUNCTION JSON2SB(json_response)
LOCAL r,t,x,a
r = MID(json_response,2)
r = LEFT(r,LEN(r) - 1)
r = REPLACE(r, "\"", "")
SPLITA r BY "," TO t
FOR x = 0 to UBOUND(t)
a{LEFT(t[x],INSTR(t[x],":")-1)} = MID(t[x],INSTR(t[x],":")+1)
NEXT
JSON2SB = a
END FUNCTION
'**************
' PhoneFacade *
'**************
FUNCTION getPhoneType()
LOCAL r, a
PRINT #1,"""{"id":""" & id & ""","method":"getPhoneType","params":[]}\n"""
LINE INPUT #1, r
a = JSON2SB(r)
IF a{"error") <> "null" THEN
getPhoneType = undef
ELSE
getPhoneType = a{"result"}
END IF
id += 1
END FUNCTION
END MODULE
r = """{"error":null,"id":1,"result":"gsm"}"""
r = MID(r,2)
r = LEFT(r,LEN(r) - 1)
r = REPLACE(r, "\"", "")
SPLITA r BY "," TO t
FOR x = 0 to UBOUND(t)
a{LEFT(t[x],INSTR(t[x],":")-1)} = MID(t[x],INSTR(t[x],":")+1)
NEXT
PRINT a{"error"},"\n"
PRINT a{"id"},"\n"
PRINT a{"result"},"\n"
OPEN "localhost:56098" FOR SOCKET AS #1
PRINT #1,"{id:1,method:makeToast,params:[\"ScriptBasic\"]}"