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

RFC: partial reorganization of the CPS format. #32

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

silseva
Copy link
Contributor

@silseva silseva commented Oct 7, 2023

Header:

  • changed the magic field from 64 to 32 bit
  • extented the version number from 16 to 32 bit

Channel:

See also #31

Header:
- changed the magic field from 64 to 32 bit
- extented the version number from 16 to 32 bit

Channel:
- changed transmit power from dBm to mW, extending the field from 8 to 32 bit
- dropped the scan list index field
- dropped the group list index field
- changed the longitude field from 8 to 16 bit to fix #30
Contacts:
- extended info field to 15 bytes, padding the structure to 48 byte and to leave space for future extensions

Channels:
- extended info to 9 bytes, padding the structure to 96 byte and to leave space for future extensions
- dropped the 20kHz channel bandwidth

M17 channel info block:
- dropped split TX and RX CAN and moved to a unique CAN field
- merged CAN and channel mode into the same 8 bit field
- merged encryption type and GNSS transmission in the same 8 bit field
@n1zzo n1zzo force-pushed the master branch 3 times, most recently from 53eaf93 to 2b94b43 Compare October 8, 2023 21:10
@silseva
Copy link
Contributor Author

silseva commented Oct 9, 2023

@tarxvftech
Copy link

LGTM!

Power: Max storable value is a bit less than 4.3MW.

Are we sure that's going to be enough? 😆

@silseva
Copy link
Contributor Author

silseva commented Dec 1, 2023

To do:

  • change encryption type for M17 to support AES-128, 192 and 256;
  • store the M17 AES encryption key, when present. Add a separate block for the keys, with tuples of (key lenght, key) and reference each key by its position in the block as if it was an array;
  • store M17 scrambler key, when present. Scrambler uses 8, 16, and 24 bit sized keys;
  • specify that channel name and description can be up to 32 characters, in which case the NULL terminator is omitted;
  • specify an encoding for channel name and description strings. Plain ASCII?

Updated the format used to store transmitter location:
- removed the +500m offset for altitude, converted the value to a signed type
- fix an error with negative coordinates close to zero, see #40.
@mdiepart
Copy link

Hi!
I wanted to write down a brief summary of what we discussed in Brussels with @silseva.
So I suggested that this code plug system, if we want to see a wide adoption, must include a minimum amount of flexibility.
By flexibility, I mean that each protocol should be able to be fully customized to the specific mode regarding the length of its entries.
Linked to that was the suggestion that the cps should include a way to include your own protocol with a customized length without 1) having to bring this protocol upstream into the specifications and 2) without making the codeplug incompatible with other radios (which could be the same radio with a different firmware). This would allow ham operators to tinker with it more easily, but would also allow industrial manufacturers to use the same CPS system without having to share their protocols with you.

The solution I first suggested was to include a short table at the beginning of the codeplug that would look like this (numbers are just random numbers and this example only considers contacts).

ID (1 byte) Name (null-terminated string) Length (1 byte)
0 Analog 8
1 DMR 32
2 M17 28
3 MyCustomMode 64

And then, for each entry you would have something looking like this (for one analog contact and 2 custom contact)

Mode ID (1 byte) Common data (x bytes) Mode-specific data (see lengths above)
0 aabbcc xxyyzz
3 ddeeff rrssttuuvvww
3 gghhii llmmnnooppqq

The advantage of this is that you do not really need to update the standard at all to include new modes, but you have to define each mode you want to support, including very ubiquitous ones like analog. Also, you raised the concern that managing strings can be quite computationally heavy for the smallest processors.

The final solution we came up with was to reserve the 128 first IDs for pre-defined modes. Which would mean that in all CPS using this standard, ID 0 would always be analog, 1 would always be DMR, 2 would always be M17, and so on...
All IDs from 127 and upward would need to be defined at the beginning of the codeplug.
We spare many bytes because we do not need to re-define ubiquitous modes and we still have the possibility to tinker and add custom modes.

The IDs 127 and up could be defined as explained above, but we could also not put the name of the mode, assuming that if the radio does not know about it, it does not need to know the name of the mode. The risk could be that you may encounter a mode with a "known ID" but whose definition is not what you expect (i.e. if I use id 218 for MyCustomMode and you use id 218 for YourCustomMode). However, it would be required for the table to contain the length of the various entries (contacts, channels, ...). That way you can at least check that the IDs above 127 have the expected length. You also know what is the length of the entries if you do not know about the mode.

This solution also means that the radios are expected to keep a table of the lengths of all the modes included in the standard because it might encounter any of those including some it does not support.

Not having a table for the IDs below 127 also means that any update to the standard including a new protocol would not be backward compatible, because if I don't know about ID 17 yet, then I have no idea what is the length of the entry and so the rest of the codeplug becomes unreadable.

Anyway, that is what I remember about what we talked about more than a month ago.

Any remarks are welcome from anybody that might read this comment 😄

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

Successfully merging this pull request may close these issues.

Codeplug: longitude field in geo_t structure too small
3 participants