Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDU creates invalid messages when > allowed length #81

Open
vai-brma opened this issue Mar 7, 2017 · 4 comments
Open

PDU creates invalid messages when > allowed length #81

vai-brma opened this issue Mar 7, 2017 · 4 comments

Comments

@vai-brma
Copy link

vai-brma commented Mar 7, 2017

The pdu.py splits long messages up depending on the type of string (GSM-7, UCS2,8-bit)
But the calculated lengths are wrong and cause modem errors.

attached is a fixed version that works with Multitech MTD-H5
pdu.py.txt

@tomchy
Copy link

tomchy commented Mar 7, 2017

Hi!
could you test if this issue occurs inside following updated fork ?
It has several updates and fixes, including long PDUs 🙂.

@vai-brma
Copy link
Author

vai-brma commented Mar 7, 2017 via email

@tomchy
Copy link

tomchy commented Mar 8, 2017

Could you explain that/provide an example?

Current implementation passes following unit tests (last test inside test_pdu.py):

    def test_encode_Ucs2_divideSMS(self):
        """ Tests whether text will be devided into a correct number of chunks while using UCS-2 alphabet"""
        text = "12345-010 12345-020 12345-030 12345-040 12345-050 12345-060"
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 1)
        text = "12345-010 12345-020 12345-030 12345-040 12345-050 12345-060 1234567"
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 1)
        text = "12345-010 12345-020 12345-030 12345-040 12345-050 12345-060 12345678"
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 2)
        text = "12345-010 12345-020 12345-030 12345-040 12345-050 12345-060 123456["
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 1)
        text = "12345-010 12345-020 12345-030 12345-040 12345-050 12345-060 1234567["
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 2)
        text = "12345-010,12345-020,12345-030,12345-040,12345-050,12345-060,123456 12345-010,12345-020,12345-030,12345-040,12345-050,12345-060,1234567"
        self.assertEqual(len(gsmmodem.pdu.divideTextUcs2(text)), 2)

@vai-brma
Copy link
Author

vai-brma commented Mar 8, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants