Is it possible to send special characters using system.serial.writeBytes or system.serial.write? (GSM-7 encoding)
Danish letters in AT command
String to bytes in both Python 2 and 3
Python library for converting plain text (ASCII) into GSM 7-bit character set?
Convert string to list of bits and viceversa
Although I can get a chain of 7-bit characters like
48656c6c6f20576f726c64 I’m unable to write that exact character chain using
You need to get the bytes into a java array of bytes. Python 2 type are inadequate. Jython’s jarray module is what you need, paired with system.serial.writeBytes.
Ok, that’s something I wouldn’t have thought about.
After having a look at it, I think it should be: string → 7-bit GSM → toBit → jarray module.
I’ll try it out tomorrow. Thanks again @pturmel
If you include a GSM-7 charset provider (an exercise for the reader; there’s an open-source implementation here: GitHub - OpenSmpp/opensmpp: OpenSmpp - Java library implementing the SMPP protocol, and allowing development of External Short Message Entities (ESMEs) and more.) you could create a Java
String instance from a Jython string and just call
someString.getBytes("GSM-7"). Manually encoding to/from GSM-7 will be tricky.
After some testing today I used:
bitList = [0,0,0,0,0,0,1,0]
jarrayBit = array(bitList, 'b')
system.serial.write(). Both gave me the same results with the device I’m using; which was nothing but I learned a few things along the line and I used system.serial.write() with ISO-8859-1.
It is tricky. I had a dive in it today reaching to sites like this: DoubleBlak [Blog Post]
Btw, there is a typo in the manual for ISO-8859-1. It has a zero instead of an “O”