Narrow CodingSource to the two bodies, and file Locality's remaining work
Mirror / push (push) Has been cancelled
Test / test (20) (pull_request) Successful in 1m33s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 33s
Test / test (26) (pull_request) Successful in 40s
Test / lint (pull_request) Successful in 24s
Test / test (18) (pull_request) Successful in 32s

This commit is contained in:
2026-09-28 02:09:42 +02:00
parent 2a6df3ffe2
commit 65fadfc93a
2 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -75,23 +75,23 @@ type ResolvedBody = {
* What the PDU's data_coding describes, and so what may set it: short_message wherever it holds an
* octet, since messageOctets() reads it there, and message_payload only where it does not.
*/
type CodingSource = 'caller' | 'message_payload' | 'short_message';
type CodingSource = 'message_payload' | 'short_message';
function codingOf(params: Record<string, ParamValue | undefined>): number | undefined {
return typeof params.data_coding === 'number' ? params.data_coding : undefined;
}
/** Only the short_message the command's own table will write, since writeParams() ignores any other. */
function resolveShortMessage(
params: Record<string, ParamValue | undefined>,
definition: CommandDefinition,
): Result<{ params: Record<string, ParamValue | undefined>; source: CodingSource }> {
// Only the short_message the command's own table will write, since writeParams() ignores any other.
const message = definition.params?.short_message === undefined ? undefined : params.short_message;
if (Buffer.isBuffer(message)) {
return {
params: params.sm_length === undefined ? { ...params, sm_length: message.length } : params,
source: message.length > 0 ? 'caller' : 'message_payload',
source: message.length > 0 ? 'short_message' : 'message_payload',
};
}