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

question about message length and bitmap size #14

Closed
torgilf opened this issue Mar 9, 2018 · 4 comments
Closed

question about message length and bitmap size #14

torgilf opened this issue Mar 9, 2018 · 4 comments

Comments

@torgilf
Copy link

torgilf commented Mar 9, 2018

After running som tests on "real world" messages I've got two questions:

  1. Message size (=length) is not part of the ISO standard but anyway sometimes found as a header before the message. The format of this header could differ, for example: not present, two bytes hex or four bytes ascii decimal. As far as I can see this implementation is using two bytes for message length:

let len1 = parseInt(buffer.slice(0,1).toString('hex'), 16);
let len2 = parseInt(buffer.slice(1,2).toString('hex'), 16);
let actualLen = (256*len1)+len2;
buffer = buffer.slice(2,buffer.byteLength);

Would be a nice feature if the message length header was optional or configurable.

  1. The ISO standard specifies bitmap size to 8, 16 or 24 bytes. First bit of bitmap is used to indicate if next bitmap is present. It seems like this implementation has hardcoded bitmap size to 16 bytes:

let bitmap = getHex(incoming.slice(4, 20).toString('hex')).split('').map(Number);

Description from Wikipedia

The bitmap may be represented as 8 bytes of binary data, or as sixteen hexadecimal characters (0-9, A-F) in the ASCII or EBCDIC character sets. A message will contain at least one bitmap, called the primary bitmap, which indicates which of data elements 1 to 64 are present. The presence of an optional secondary bitmap is also indicated by bit 1 of the primary bitmap. If present, the secondary bitmap indicates whether data elements 65 to 128 are present. Similarly, a tertiary bitmap can be used to indicate the presence of fields 129 to 192, although these data elements are rarely used.

Would it be possible to add support for one, two or three bitmaps according to the ISO standard?

@zemuldo
Copy link
Owner

zemuldo commented Mar 21, 2018

Hi @torgilf i am looking into this. Thanks.

@zemuldo
Copy link
Owner

zemuldo commented Mar 21, 2018

Hi @torgilf @timgabets
I have added a new pull request on this branch
It has iso 2003 support with 129... extended fields and auto tertiary bitmap adjustment

@zemuldo
Copy link
Owner

zemuldo commented Mar 26, 2018

@torgilf Am closing this issue coz i believe it has been resolved

@zemuldo zemuldo closed this as completed Apr 4, 2018
@riliwanrabo
Copy link

Hi @zemuldo 🤩
The link above returns a 404

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

3 participants