@foxglove/rtps
Advanced tools
Comparing version 1.4.0 to 1.4.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DurabilityService = void 0; | ||
const _1 = require("."); | ||
class DurabilityService { | ||
@@ -14,3 +15,3 @@ constructor(leaseDuration, historyKind, historyDepth, maxSamples, maxInstances, maxSamplesPerInstance) { | ||
static fromCDR(reader) { | ||
const leaseDuration = { sec: reader.int32(), nsec: reader.uint32() }; | ||
const leaseDuration = { sec: reader.int32(), nsec: (0, _1.fractionToNanoseconds)(reader.uint32()) }; | ||
const historyKind = reader.uint32(); | ||
@@ -17,0 +18,0 @@ const historyDepth = reader.int32(); |
@@ -14,3 +14,4 @@ export * from "./DurabilityService"; | ||
export * from "./SequenceNumberSet"; | ||
export * from "./time"; | ||
export * from "./types"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -26,3 +26,4 @@ "use strict"; | ||
__exportStar(require("./SequenceNumberSet"), exports); | ||
__exportStar(require("./time"), exports); | ||
__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -45,3 +45,3 @@ "use strict"; | ||
expect(infoTs.octetsToNextHeader).toEqual(8); | ||
expect(infoTs.timestamp).toEqual({ sec: 1625943731, nsec: 1222751420 }); | ||
expect(infoTs.timestamp).toEqual({ sec: 1625943731, nsec: 284694000 }); | ||
const dataMsg = subMessages[1]; | ||
@@ -64,3 +64,3 @@ expect(dataMsg instanceof submessages_1.DataMsgView).toEqual(true); | ||
expect(dataMsg.serializedData).toEqual(data.slice(56, 56 + 228)); | ||
expect(dataMsg.effectiveTimestamp).toEqual({ sec: 1625943731, nsec: 1222751420 }); | ||
expect(dataMsg.effectiveTimestamp).toEqual({ sec: 1625943731, nsec: 284694000 }); | ||
let params = ParametersView_1.ParametersView.FromCdr(dataMsg.serializedData); | ||
@@ -156,3 +156,3 @@ expect(params).toBeDefined(); | ||
kind: common_1.Reliability.Reliable, | ||
maxBlockingTime: { nsec: 4294967295, sec: 2147483647 }, | ||
maxBlockingTime: { nsec: 999999999, sec: 2147483647 }, | ||
}); | ||
@@ -159,0 +159,0 @@ expect(allParams.get(common_1.ParameterId.PID_LIFESPAN)).toEqual({ sec: 10, nsec: 0 }); |
@@ -37,3 +37,3 @@ "use strict"; | ||
this.writer.int32(value.maxBlockingTime.sec); | ||
this.writer.uint32(value.maxBlockingTime.nsec); | ||
this.writer.uint32((0, common_1.nanosecondsToFraction)(value.maxBlockingTime.nsec)); | ||
this.writer.align(4); | ||
@@ -86,3 +86,3 @@ } | ||
this.writer.int32(value.sec); | ||
this.writer.uint32(value.nsec); | ||
this.writer.uint32((0, common_1.nanosecondsToFraction)(value.nsec)); | ||
this.writer.align(4); | ||
@@ -89,0 +89,0 @@ } |
@@ -215,3 +215,3 @@ "use strict"; | ||
function readTime(reader) { | ||
return { sec: reader.int32(), nsec: reader.uint32() }; | ||
return { sec: reader.int32(), nsec: (0, common_1.fractionToNanoseconds)(reader.uint32()) }; | ||
} | ||
@@ -218,0 +218,0 @@ function isMultiParameter(parameterId) { |
@@ -16,3 +16,3 @@ "use strict"; | ||
output.setInt32(offset + 4, this.timestamp.sec, littleEndian); | ||
output.setUint32(offset + 8, this.timestamp.nsec, littleEndian); | ||
output.setUint32(offset + 8, (0, common_1.nanosecondsToFraction)(this.timestamp.nsec), littleEndian); | ||
return 12; | ||
@@ -25,3 +25,4 @@ } | ||
const sec = this.view.getInt32(this.offset + 4, this.littleEndian); | ||
const nsec = this.view.getUint32(this.offset + 8, this.littleEndian); | ||
const fraction = this.view.getUint32(this.offset + 8, this.littleEndian); | ||
const nsec = (0, common_1.fractionToNanoseconds)(fraction); | ||
return { sec, nsec }; | ||
@@ -28,0 +29,0 @@ } |
{ | ||
"name": "@foxglove/rtps", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Real-Time Publish Subscribe (DDS-RTPS) protocol implementation with a pluggable transport layer. This is a subset of the complete specification optimized for ROS 2 (Robot Operating System) connections", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
import { CdrReader } from "@foxglove/cdr"; | ||
import { Time } from "@foxglove/rostime"; | ||
import { fractionToNanoseconds } from "."; | ||
import { HistoryKind } from "./enums"; | ||
@@ -17,3 +18,3 @@ | ||
static fromCDR(reader: CdrReader): DurabilityService { | ||
const leaseDuration = { sec: reader.int32(), nsec: reader.uint32() }; | ||
const leaseDuration = { sec: reader.int32(), nsec: fractionToNanoseconds(reader.uint32()) }; | ||
const historyKind = reader.uint32() as HistoryKind; | ||
@@ -20,0 +21,0 @@ const historyDepth = reader.int32(); |
@@ -14,2 +14,3 @@ export * from "./DurabilityService"; | ||
export * from "./SequenceNumberSet"; | ||
export * from "./time"; | ||
export * from "./types"; |
@@ -58,3 +58,3 @@ import { | ||
expect(infoTs.octetsToNextHeader).toEqual(8); | ||
expect(infoTs.timestamp).toEqual({ sec: 1625943731, nsec: 1222751420 }); | ||
expect(infoTs.timestamp).toEqual({ sec: 1625943731, nsec: 284694000 }); | ||
@@ -78,3 +78,3 @@ const dataMsg = subMessages[1]! as DataMsgView; | ||
expect(dataMsg.serializedData).toEqual(data.slice(56, 56 + 228)); | ||
expect(dataMsg.effectiveTimestamp).toEqual({ sec: 1625943731, nsec: 1222751420 }); | ||
expect(dataMsg.effectiveTimestamp).toEqual({ sec: 1625943731, nsec: 284694000 }); | ||
@@ -174,3 +174,3 @@ let params = ParametersView.FromCdr(dataMsg.serializedData)!; | ||
kind: Reliability.Reliable, | ||
maxBlockingTime: { nsec: 4294967295, sec: 2147483647 }, | ||
maxBlockingTime: { nsec: 999999999, sec: 2147483647 }, | ||
}); | ||
@@ -177,0 +177,0 @@ expect(allParams.get(ParameterId.PID_LIFESPAN)).toEqual({ sec: 10, nsec: 0 }); |
@@ -15,2 +15,3 @@ import { CdrWriter, EncapsulationKind } from "@foxglove/cdr"; | ||
ReliabilityAndMaxBlockingTime, | ||
nanosecondsToFraction, | ||
} from "../common"; | ||
@@ -54,3 +55,3 @@ | ||
this.writer.int32(value.maxBlockingTime.sec); | ||
this.writer.uint32(value.maxBlockingTime.nsec); | ||
this.writer.uint32(nanosecondsToFraction(value.maxBlockingTime.nsec)); | ||
this.writer.align(4); | ||
@@ -111,3 +112,3 @@ } | ||
this.writer.int32(value.sec); | ||
this.writer.uint32(value.nsec); | ||
this.writer.uint32(nanosecondsToFraction(value.nsec)); | ||
this.writer.align(4); | ||
@@ -114,0 +115,0 @@ } |
@@ -18,2 +18,3 @@ import { CdrReader, EncapsulationKind } from "@foxglove/cdr"; | ||
ReliabilityAndMaxBlockingTime, | ||
fractionToNanoseconds, | ||
} from "../common"; | ||
@@ -260,3 +261,3 @@ | ||
function readTime(reader: CdrReader): Time { | ||
return { sec: reader.int32(), nsec: reader.uint32() }; | ||
return { sec: reader.int32(), nsec: fractionToNanoseconds(reader.uint32()) }; | ||
} | ||
@@ -263,0 +264,0 @@ |
import { Time } from "@foxglove/rostime"; | ||
import { LittleEndian, SubMessageId } from "../../common"; | ||
import { | ||
fractionToNanoseconds, | ||
LittleEndian, | ||
nanosecondsToFraction, | ||
SubMessageId, | ||
} from "../../common"; | ||
import { SubMessage } from "../SubMessage"; | ||
@@ -17,3 +22,3 @@ import { SubMessageView } from "../SubMessageView"; | ||
output.setInt32(offset + 4, this.timestamp.sec, littleEndian); | ||
output.setUint32(offset + 8, this.timestamp.nsec, littleEndian); | ||
output.setUint32(offset + 8, nanosecondsToFraction(this.timestamp.nsec), littleEndian); | ||
return 12; | ||
@@ -26,5 +31,6 @@ } | ||
const sec = this.view.getInt32(this.offset + 4, this.littleEndian); | ||
const nsec = this.view.getUint32(this.offset + 8, this.littleEndian); | ||
const fraction = this.view.getUint32(this.offset + 8, this.littleEndian); | ||
const nsec = fractionToNanoseconds(fraction); | ||
return { sec, nsec }; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
707364
385
10868