Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting" LITTLE_ENDIAN
RELATED_ITEM <%= target_name %> PARAMS VALUE<%= i %>
<% end %>
APPEND_PARAMETER BIGINT 64 UINT MIN MAX 0 "UINT 64 parameter"
SCREEN <%= target_name %> PARAMS

SELECT_PARAMETER VALUE5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ TELEMETRY <%= target_name %> PARAMS BIG_ENDIAN "Params set by SETPARAMS command"
STATE BAD 1 RED
<% end %>
APPEND_ITEM IP_ADDRESS 32 UINT "Encoded IP Address"
APPEND_ITEM P_2.2,2 32 UINT "Test weird characters"
APPEND_ITEM P-3+3=3 32 UINT "Test weird characters"
APPEND_ITEM P4!@#$%^&*? 32 UINT "Test weird characters"
APPEND_ITEM P</5|\> 32 UINT "Test weird characters"
APPEND_ITEM P(:6;) 32 UINT "Test weird characters"
APPEND_ITEM P_2.2,2 64 INT "Test weird characters"
APPEND_ITEM P-3+3=3 64 INT "Test weird characters"
APPEND_ITEM P4!@#$%^&*? 64 UINT "Test weird characters"
APPEND_ITEM P</5|\> 64 UINT "Test weird characters"
APPEND_ITEM P(:6;) 64 UINT "Test weird characters"
ITEM PACKET_TIME 0 0 DERIVED "Ruby time based on TIMESEC and TIMEUS"
READ_CONVERSION unix_time_conversion.rb TIMESEC TIMEUS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# GNU Affero General Public License for more details.

# Modified by OpenC3, Inc.
# All changes Copyright 2024, OpenC3, Inc.
# All changes Copyright 2025, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
Expand All @@ -25,6 +25,7 @@
require 'openc3'
require 'stringio'
require 'base64'
require 'openc3/accessors/binary_accessor'

module OpenC3
# Simulated instrument for the demo. Populates several packets and cycles
Expand Down Expand Up @@ -111,11 +112,11 @@ def initialize(target_name)
packet.value3 = 2
packet.value4 = 1
packet.value5 = 0
packet.write('P_2.2,2', 2)
packet.write('P-3+3=3', 3)
packet.write('P4!@#$%^&*?', 4)
packet.write('P</5|\>', 5)
packet.write('P(:6;)', 6)
packet.write('P_2.2,2', BinaryAccessor::MIN_INT64)
packet.write('P-3+3=3', BinaryAccessor::MAX_INT64)
packet.write('P4!@#$%^&*?', 0)
packet.write('P</5|\>', 1740684371613049856)
packet.write('P(:6;)', BinaryAccessor::MAX_UINT64)

packet = @tlm_packets['IMAGE']
packet.enable_method_missing
Expand Down Expand Up @@ -196,6 +197,7 @@ def write(packet)
params_packet.value3 = packet.read('value3')
params_packet.value4 = packet.read('value4')
params_packet.value5 = packet.read('value5')
params_packet.write('P4!@#$%^&*?', packet.read('bigint'))
when 'ASCIICMD'
hs_packet.cmd_acpt_cnt += 1
hs_packet.asciicmd = packet.read('string')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting" LITTLE_ENDIAN
RELATED_ITEM <%= target_name %> PARAMS VALUE<%= i %>
<% end %>
APPEND_PARAMETER BIGINT 64 UINT MIN MAX 0 "UINT 64 parameter"
SCREEN <%= target_name %> PARAMS

SELECT_PARAMETER VALUE5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ TELEMETRY <%= target_name %> PARAMS BIG_ENDIAN "Params set by SETPARAMS command"
STATE BAD 1 RED
<% end %>
APPEND_ITEM IP_ADDRESS 32 UINT "Encoded IP Address"
APPEND_ITEM P_2.2,2 32 UINT "Test weird characters"
APPEND_ITEM P-3+3=3 32 UINT "Test weird characters"
APPEND_ITEM P4!@#$%^&*? 32 UINT "Test weird characters"
APPEND_ITEM P</5|\> 32 UINT "Test weird characters"
APPEND_ITEM P(:6;) 32 UINT "Test weird characters"
APPEND_ITEM P_2.2,2 64 INT "Test weird characters"
APPEND_ITEM P-3+3=3 64 INT "Test weird characters"
APPEND_ITEM P4!@#$%^&*? 64 UINT "Test weird characters"
APPEND_ITEM P</5|\> 64 UINT "Test weird characters"
APPEND_ITEM P(:6;) 64 UINT "Test weird characters"
ITEM PACKET_TIME 0 0 DERIVED "Python time based on TIMESEC and TIMEUS"
READ_CONVERSION openc3/conversions/unix_time_conversion.py TIMESEC TIMEUS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 OpenC3, Inc.
# Copyright 2025 OpenC3, Inc.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
Expand All @@ -25,6 +25,7 @@
from openc3.packets.packet import Packet
from openc3.system.system import System
from openc3.top_level import kill_thread
from openc3.accessors.binary_accessor import BinaryAccessor


# Simulated instrument for the demo. Populates several packets and cycles
Expand Down Expand Up @@ -114,11 +115,11 @@ def __init__(self, target_name):
packet.write("value3", 2)
packet.write("value4", 1)
packet.write("value5", 0)
packet.write('P_2.2,2', 2)
packet.write('P-3+3=3', 3)
packet.write('P4!@#$%^&*?', 4)
packet.write('P</5|\>', 5)
packet.write('P(:6;)', 6)
packet.write('P_2.2,2', BinaryAccessor.MIN_INT64)
packet.write('P-3+3=3', BinaryAccessor.MAX_INT64)
packet.write('P4!@#$%^&*?', 0)
packet.write('P</5|\>', 1740684371613049856)
packet.write('P(:6;)', BinaryAccessor.MAX_UINT64)

packet = self.tlm_packets["IMAGE"]
packet.write("CcsdsSeqFlags", "NOGROUP")
Expand Down Expand Up @@ -187,6 +188,7 @@ def write(self, packet):
params_packet.write("value3", packet.read("value3"))
params_packet.write("value4", packet.read("value4"))
params_packet.write("value5", packet.read("value5"))
params_packet.write('P4!@#$%^&*?', packet.read('bigint'))
case "ASCIICMD":
hs_packet.write("cmd_acpt_cnt", hs_packet.read("cmd_acpt_cnt") + 1)
hs_packet.write("asciicmd", packet.read("string"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# GNU Affero General Public License for more details.

# Modified by OpenC3, Inc.
# All changes Copyright 2024, OpenC3, Inc.
# All changes Copyright 2025, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
Expand Down Expand Up @@ -184,7 +184,9 @@
<v-card-text class="mt-6">
Warning: Command {{ hazardousCommand }} is Hazardous. Send?
<br />
<span class="openc3-yellow"> Description: {{ commandDescription }} </span>
<span class="openc3-yellow">
Description: {{ commandDescription }}
</span>
</v-card-text>
<v-card-actions class="px-2">
<v-spacer />
Expand Down Expand Up @@ -491,7 +493,13 @@ export default {
} else if (this.isFloat(str)) {
return parseFloat(str)
} else if (this.isInt(str)) {
return parseInt(str)
// If this is a number that is too large for a JS number
// then we convert it to a BigInt which gets serialized in openc3Api.js
if (!Number.isSafeInteger(Number(str))) {
return BigInt(str)
} else {
return parseInt(str)
}
} else if (this.isArray(str)) {
return eval(str)
} else {
Expand Down Expand Up @@ -576,10 +584,14 @@ export default {
// This is basically to handle the FLOAT MIN and MAX so they
// don't print out the huge exponential
if (parameter.minimum < -1e6) {
parameter.minimum = parameter.minimum.toExponential(3)
if (Number.isSafeInteger(parameter.minimum)) {
parameter.minimum = parameter.minimum.toExponential(3)
}
}
if (parameter.maximum > 1e6) {
parameter.maximum = parameter.maximum.toExponential(3)
if (Number.isSafeInteger(parameter.maximum)) {
parameter.maximum = parameter.maximum.toExponential(3)
}
}
}
range = `${parameter.minimum}..${parameter.maximum}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"sass": "1.85.0",
"sortablejs": "1.15.6",
"sprintf-js": "1.1.3",
"uplot": "1.6.31"
"uplot": "1.6.31",
"lossless-json": "4.0.2"
},
"devDependencies": {
"eslint": "9.20.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
*/

import axios from './axios.js'
import { parse, stringify, isSafeNumber } from 'lossless-json'

// parse huge integer values into a bigint, and use a regular number otherwise
export function customNumberParser(value) {
return isSafeNumber(value) ? parseFloat(value) : BigInt(value)
}
export default class OpenC3Api {
id = 1

Expand Down Expand Up @@ -67,6 +72,19 @@ export default class OpenC3Api {
...headerOptions,
},
timeout: timeout,
transformRequest: [
(data, headers) => {
// stringify the data with lossless-json
return stringify(data)
},
],
transformResponse: [
(data) => {
// parse the data with lossless-json ensuring that large numbers are parsed as BigInts
// but all other numbers are parsed as regular numbers
return parse(data, undefined, customNumberParser)
},
],
},
)
// let data = response.data
Expand Down
2 changes: 1 addition & 1 deletion openc3/spec/api/router_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ApiTest
expect(router).to be_a Hash
expect(router['name']).to eql "ROUTE_INT"
# Verify it also includes the status
expect(router['state']).to eql "CONNECTED"
expect(router['state']).to match(/CONNECTED|ATTEMPTING/)
expect(router['clients']).to eql 0
end
end
Expand Down
Loading
Loading