File

src/models/bulkio/bulkio-packet.ts

Description

Serializable REDHAWK BULKIO Packet model

Implements

ISerializable

Index

Properties
Methods

Methods

deserialize
deserialize(input: any)

Deserializes a JSON object into this class

Parameters :
Name Type Optional Description
input any
Returns : this

Properties

dataBuffer
dataBuffer: Array<number>
Type : Array<number>

The data buffer of the stream

EOS
EOS: boolean
Type : boolean

End of Stream (EOS) flag

SRI
SRI: SRI
Type : SRI

The Signal Related Information (SRI) structure

sriChanged
sriChanged: boolean
Type : boolean

Flag for if the SRI has changed

streamID
streamID: string
Type : string

Stream ID

T
T: PrecisionUTCTime
Type : PrecisionUTCTime

Precision Time Stamp

type
type: BulkioDataType
Type : BulkioDataType

The Data Type of the buffer

import { ISerializable } from '../serialization/index';
import { BulkioDataType } from './enums/index';

import { SRI } from './sri';
import { PrecisionUTCTime } from './precision-utc-time';

/**
 * Serializable REDHAWK BULKIO Packet model
 */
export class BulkioPacket implements ISerializable<BulkioPacket> {
    /** Stream ID */
    streamID: string;
    /** Precision Time Stamp */
    T: PrecisionUTCTime;
    /** End of Stream (EOS) flag */
    EOS: boolean;
    /** Flag for if the SRI has changed */
    sriChanged: boolean;
    /**  The Signal Related Information (SRI) structure */
    SRI: SRI;
    /** The Data Type of the buffer */
    type: BulkioDataType;
    /** The data buffer of the stream */
    dataBuffer: Array<number>;

    /** Deserializes a JSON object into this class */
    deserialize(input: any) {
        this.streamID = input.streamID;
        this.T = new PrecisionUTCTime().deserialize(input.T);
        this.EOS = input.EOS;
        this.sriChanged = input.sriChanged;
        this.SRI = new SRI().deserialize(input.SRI);
        this.type = resolve(input.type);
        this.dataBuffer = input.dataBuffer;
        return this;
    }
}

function resolve(dataType: string): BulkioDataType {
    switch (dataType) {
        // case 'dataOctet':
        //     return BulkioDataType.dataOctet;
        case 'dataShort':
            return BulkioDataType.dataShort;
        case 'dataLong':
            return BulkioDataType.dataLong;
        case 'dataLongLong':
            return BulkioDataType.dataLongLong;
        case 'dataULong' :
            return BulkioDataType.dataULong;
        case 'dataULongLong' :
            return BulkioDataType.dataULongLong;
        case 'dataFloat' :
            return BulkioDataType.dataFloat;
        case 'dataDouble' :
            return BulkioDataType.dataDouble;
        default:
            return BulkioDataType.UNKNOWN;
    }
}

results matching ""

    No results matching ""