Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Makefile
obj/
Build/
build/
build-vs/
install/
CMakeCache.txt
*.dir/
CMakeFiles
Expand Down
30 changes: 2 additions & 28 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,2 @@
image:
- Visual Studio 2019

install:
- curl -o C:\SDL2.zip https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip
- curl -o C:\SDL2_net.zip https://www.libsdl.org/projects/SDL_net/release/SDL2_net-devel-2.0.1-VC.zip
- 7z x C:\SDL2.zip -oC:\ -y
- move C:\SDL2-2.0.12 C:\SDL2
- 7z x C:\SDL2_net.zip -oC:\ -y
- move C:\SDL2_net-2.0.1 C:\SDL2_net
- xcopy /s C:\SDL2_net\lib C:\SDL2\lib
- xcopy /s C:\SDL2_net\include C:\SDL2\include
- dir /s C:\SDL2

platform: x64

build:
project: OpenDIS.sln

before_build:
- cmake -DSDL2_PATH=C:\SDL2 -DSDL2_NET_PATH=C:\SDL2 -DCMAKE_LIBRARY_ARCHITECTURE=x64 -DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON .
- dir

test_script:
- ctest -C Debug

on_finish:
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test\UnitTestSuite-results.xml))
build: off
test: off
4 changes: 4 additions & 0 deletions src/dis7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ set(dis7_hdr
ServiceRequestPdu.h
SetDataPdu.h
SetDataReliablePdu.h
SignalPdu.h
SimulationAddress.h
SimulationIdentifier.h
SimulationManagementFamilyPdu.h
Expand All @@ -164,6 +165,7 @@ set(dis7_hdr
SystemIdentifier.h
TotalRecordSets.h
TrackJamData.h
TransmitterPdu.h
TwoByteChunk.h
UAFundamentalParameter.h
UaPdu.h
Expand Down Expand Up @@ -326,6 +328,7 @@ set(dis7_src
ServiceRequestPdu.cpp
SetDataPdu.cpp
SetDataReliablePdu.cpp
SignalPdu.cpp
SimulationAddress.cpp
SimulationIdentifier.cpp
SimulationManagementFamilyPdu.cpp
Expand All @@ -343,6 +346,7 @@ set(dis7_src
SystemIdentifier.cpp
TotalRecordSets.cpp
TrackJamData.cpp
TransmitterPdu.cpp
TwoByteChunk.cpp
UAFundamentalParameter.cpp
UaPdu.cpp
Expand Down
131 changes: 131 additions & 0 deletions src/dis7/SignalPdu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#include <dis7/SignalPdu.h>

using namespace DIS;

SignalPdu::SignalPdu()
: RadioCommunicationsFamilyPdu(), _encodingScheme(0), _tdlType(0),
_sampleRate(0), _dataLength(0), _samples(0)
{
setPduType(26);
}

SignalPdu::~SignalPdu() { _data.clear(); }

unsigned short SignalPdu::getEncodingScheme() const { return _encodingScheme; }

void SignalPdu::setEncodingScheme(unsigned short pX) { _encodingScheme = pX; }

unsigned short SignalPdu::getTdlType() const { return _tdlType; }

void SignalPdu::setTdlType(unsigned short pX) { _tdlType = pX; }

unsigned int SignalPdu::getSampleRate() const { return _sampleRate; }

void SignalPdu::setSampleRate(unsigned int pX) { _sampleRate = pX; }

short SignalPdu::getDataLength() const { return _dataLength; }

void SignalPdu::setDataLength(short pX) { _dataLength = pX; }

short SignalPdu::getSamples() const { return _samples; }

void SignalPdu::setSamples(short pX) { _samples = pX; }

std::vector<uint8_t> &SignalPdu::getData() { return _data; }

const std::vector<uint8_t> &SignalPdu::getData() const { return _data; }

void SignalPdu::setData(const std::vector<uint8_t> &pX) { _data = pX; }

void SignalPdu::marshal(DataStream &dataStream) const
{
RadioCommunicationsFamilyPdu::marshal(
dataStream); // Marshal information in superclass first
dataStream << _encodingScheme;
dataStream << _tdlType;
dataStream << _sampleRate;
dataStream << (short)_dataLength;
dataStream << _samples;
for (auto byte : _data)
{
dataStream << byte;
}
}

void SignalPdu::unmarshal(DataStream &dataStream)
{
RadioCommunicationsFamilyPdu::unmarshal(
dataStream); // unmarshal information in superclass first
dataStream >> _encodingScheme;
dataStream >> _tdlType;
dataStream >> _sampleRate;
dataStream >> _dataLength;
dataStream >> _samples;

_data.clear();
const int dataLengthBytes = (_dataLength + 7) / 8; // bits to bytes
for (auto idx = 0; idx < dataLengthBytes; ++idx)
{
uint8_t x;
dataStream >> x;
_data.push_back(x);
}
}

bool SignalPdu::operator==(const SignalPdu &rhs) const
{
auto ivarsEqual = true;

ivarsEqual = RadioCommunicationsFamilyPdu::operator==(rhs) &&
_encodingScheme == rhs._encodingScheme &&
_tdlType == rhs._tdlType && _sampleRate == rhs._sampleRate &&
_samples == rhs._samples && _data == rhs._data;

return ivarsEqual;
}

int SignalPdu::getMarshalledSize() const
{
auto marshalSize = 0;

marshalSize = RadioCommunicationsFamilyPdu::getMarshalledSize();
marshalSize += 2; // _encodingScheme
marshalSize += 2; // _tdlType
marshalSize += 4; // _sampleRate
marshalSize += 2; // _dataLength
marshalSize += 2; // _samples
marshalSize += _data.size();

return marshalSize;
}

// Copyright (c) 1995-2009 held by the author(s). All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the names of the Naval Postgraduate School (NPS)
// Modeling Virtual Environments and Simulation (MOVES) Institute
// (http://www.nps.edu and http://www.MovesInstitute.org)
// nor the names of its contributors may be used to endorse or
// promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
102 changes: 102 additions & 0 deletions src/dis7/SignalPdu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#pragma once

#include <dis7/RadioCommunicationsFamilyPdu.h>
#include <dis7/opendis7_export.h>
#include <dis7/utils/DataStream.h>
#include <cstdint>
#include <vector>

namespace DIS
{
// Section 7.7.3 (IEEE 1278.1-2012). Detailed information about a radio transmission.
// This PDU requires manually written code to complete. The encodingScheme field
// can be used in multiple ways, which requires hand-written code to finish. UNFINISHED

// Copyright (c) 2007-2009, MOVES Institute, Naval Postgraduate School. All
// rights reserved.
//
// @author DMcG, jkg

class OPENDIS7_EXPORT SignalPdu : public RadioCommunicationsFamilyPdu
{
protected:
/** encoding scheme used, and enumeration */
unsigned short _encodingScheme;

/** tdl type */
unsigned short _tdlType;

/** sample rate */
unsigned int _sampleRate;

/** length of data in bits */
short _dataLength;

/** number of samples */
short _samples;

/** list of eight bit values */
std::vector<uint8_t> _data;

public:
SignalPdu();
virtual ~SignalPdu();

virtual void marshal(DataStream &dataStream) const;
virtual void unmarshal(DataStream &dataStream);

unsigned short getEncodingScheme() const;
void setEncodingScheme(unsigned short pX);

unsigned short getTdlType() const;
void setTdlType(unsigned short pX);

unsigned int getSampleRate() const;
void setSampleRate(unsigned int pX);

short getDataLength() const;
void setDataLength(short pX);

short getSamples() const;
void setSamples(short pX);

std::vector<uint8_t> &getData();
const std::vector<uint8_t> &getData() const;
void setData(const std::vector<uint8_t> &pX);

virtual int getMarshalledSize() const;

bool operator==(const SignalPdu &rhs) const;
};
} // namespace DIS

// Copyright (c) 1995-2009 held by the author(s). All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the names of the Naval Postgraduate School (NPS)
// Modeling Virtual Environments and Simulation (MOVES) Institute
// (http://www.nps.edu and http://www.MovesInstitute.org)
// nor the names of its contributors may be used to endorse or
// promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
Loading