commit 10/24/2015
This commit is contained in:
@@ -33,6 +33,7 @@ import time
|
||||
import serial
|
||||
import logging
|
||||
from lib.sim900.simshared import *
|
||||
import struct
|
||||
|
||||
class GsmSpecialCharacters:
|
||||
ctrlz = 26 #//Ascii character for ctr+z. End of a SMS.
|
||||
@@ -132,7 +133,7 @@ class SimGsmSerialPortHandler(AminisLastErrorHolderWithLogging):
|
||||
"""
|
||||
return self.print(commandLine, encoding)
|
||||
|
||||
def printLn(self, commandString, encoding = "ascii"):
|
||||
def printLn(self, commandString, bytes=None, encoding = "ascii"):
|
||||
"""
|
||||
Sends string data and CR/LF in the end to the SIM module
|
||||
|
||||
@@ -140,10 +141,16 @@ class SimGsmSerialPortHandler(AminisLastErrorHolderWithLogging):
|
||||
:param encoding: before sending string it will be converted to the bytearray with this encoding
|
||||
:return: True if data sent, otherwise returns False
|
||||
"""
|
||||
data = bytearray(commandString, encoding) + bytearray([GsmSpecialCharacters.cr, GsmSpecialCharacters.lf])
|
||||
if bytes is not None:
|
||||
data = bytearray(commandString, encoding) + bytes + bytearray([GsmSpecialCharacters.cr, GsmSpecialCharacters.lf])
|
||||
else:
|
||||
data= bytearray(commandString, encoding) + bytearray([GsmSpecialCharacters.cr, GsmSpecialCharacters.lf])
|
||||
|
||||
# print("Print Line data: {}".format(data))
|
||||
|
||||
return self.__sendRawBytes(data)
|
||||
|
||||
def simpleWriteLn(self, commandLine, encoding = "ascii"):
|
||||
def simpleWriteLn(self, commandLine, bytes=None, encoding = "ascii"):
|
||||
"""
|
||||
Just alias for printLn() method
|
||||
|
||||
@@ -152,7 +159,7 @@ class SimGsmSerialPortHandler(AminisLastErrorHolderWithLogging):
|
||||
:return: True if data sent, otherwise returns False
|
||||
"""
|
||||
|
||||
return self.printLn(commandLine, encoding)
|
||||
return self.printLn(commandLine, encoding=encoding, bytes=bytes)
|
||||
|
||||
def flushInput(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user