commit 10/24/2015
This commit is contained in:
@@ -524,37 +524,48 @@ class SimInetGSM(SimGsm):
|
||||
:return: true if operation was successfully finished. Otherwise returns false
|
||||
"""
|
||||
|
||||
self.__clearHttpResponse()
|
||||
# self.__clearHttpResponse()
|
||||
|
||||
#TODO: close only when opened
|
||||
self.terminateHttpRequest()
|
||||
# self.terminateHttpRequest()
|
||||
|
||||
#HTTP POST request commands sequence
|
||||
simpleCommands = [
|
||||
[ "AT+HTTPINIT", 2000 ],
|
||||
[ "AT+HTTPPARA=\"CID\",\"{0}\"".format(bearerChannel), 1000 ],
|
||||
[ "AT+HTTPPARA=\"URL\",\"{0}:{1}{2}\"".format(server, port, path), 500 ],
|
||||
[ "AT+HTTPPARA=\"CONTENT\",\"multipart/form-data\"", 500 ],
|
||||
[ "AT+HTTPPARA=\"UA\",\"{0}\"".format(self.userAgent), 500 ],
|
||||
[ "AT+HTTPPARA=\"REDIR\",\"1\"", 500 ],
|
||||
[ "AT+HTTPPARA=\"TIMEOUT\",\"45\"", 500 ]
|
||||
]
|
||||
# simpleCommands = [
|
||||
# [ "AT+HTTPINIT", 2000 ],
|
||||
# [ "AT+HTTPPARA=\"CID\",\"{0}\"".format(bearerChannel), 1000 ],
|
||||
# [ "AT+HTTPPARA=\"URL\",\"{0}:{1}{2}\"".format(server, port, path), 500 ],
|
||||
# [ "AT+HTTPPARA=\"CONTENT\",\"multipart/form-data\"", 500 ],
|
||||
# [ "AT+HTTPPARA=\"UA\",\"{0}\"".format(self.userAgent), 500 ],
|
||||
# [ "AT+HTTPPARA=\"REDIR\",\"1\"", 500 ],
|
||||
# [ "AT+HTTPPARA=\"TIMEOUT\",\"45\"", 500 ]
|
||||
# ]
|
||||
|
||||
simpleCommands = [
|
||||
[ "AT+CGATT?", 2000 ],
|
||||
[ "AT+CIPCLOSE", 1000 ],
|
||||
# [ "AT+CIPMUX=0", 1000 ],
|
||||
[ "AT+CSTT=\"{0}\"".format('wholesale'), 1000],
|
||||
[ "AT+CIICR", 500 ],
|
||||
[ "AT+CIFSR", 500 ],
|
||||
[ "AT+CIPSTART=\"{0}\",\"{1}\",\"{2}\"".format("TCP", server, port), 500 ],
|
||||
[ "AT+CIPSEND", 500 ],
|
||||
# [ "AT+HTTPPARA=\"TIMEOUT\",\"45\"", 500 ]
|
||||
]
|
||||
#executing commands sequence
|
||||
if not self.execSimpleCommandsList(simpleCommands):
|
||||
return False
|
||||
|
||||
#uploading data
|
||||
self.logger.debug("uploading HTTP POST data")
|
||||
ret = self.commandAndStdResult(
|
||||
"AT+HTTPDATA={0},10000".format(len(parameters)),
|
||||
7000,
|
||||
["DOWNLOAD", "ERROR"]
|
||||
)
|
||||
# self.logger.debug("uploading HTTP POST data")
|
||||
# ret = self.commandAndStdResult(
|
||||
# "AT+HTTPDATA={0},10000".format(len(parameters)),
|
||||
# 7000,
|
||||
# ["DOWNLOAD", "ERROR"]
|
||||
# )
|
||||
|
||||
if (ret is None) or (self.lastResult != "DOWNLOAD"):
|
||||
self.setError("{0}: can't upload HTTP POST data".format(inspect.stack()[0][3]))
|
||||
return False
|
||||
# if (ret is None) or (self.lastResult != "DOWNLOAD"):
|
||||
# self.setError("{0}: can't upload HTTP POST data".format(inspect.stack()[0][3]))
|
||||
# return False
|
||||
|
||||
self.simpleWriteLn(parameters)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user