2#include <RawDataSensor.h>
3#include "WNetworkInformation.h"
4#include "WAngleRange.h"
5#include "WContaminationThreshold.h"
6#include "WRawDataError.h"
8#include "WSensorLeds.h"
9#include "WSensorLamps.h"
11#include <BadAcknowledgmentException.h>
12#include <CommunicationException.h>
13#include <SensorErrorException.h>
14#include <ThreadCreationException.h>
15#include "WContaminationStatus.h"
16#include "../StarfleetToolboxWrapper/WCommunicationStatus.h"
18#pragma make_public(ConfigurationResult)
20using namespace System::Collections;
21using namespace System::Collections::Generic;
27using namespace System::Runtime::InteropServices;
43 _sensor = (BaseSensor*)
new RawDataSensor(pcomm->__nativeCommunication);
44 Communication = pcomm;
58 for (
int i = 0; i < status.
Channels.size(); i++) {
94 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
122 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
144 toReturn->Gateway = gcnew String(toFetch.
GetGateway().c_str());
147 toReturn->SubnetMask = gcnew String(toFetch.
GetSubnetMask().c_str());
148 toReturn->MacAddress = gcnew String(toFetch.
GetMacAddress().c_str());
163 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
179 PROTOCOL actual = ((
RawDataSensor*)_sensor)->GetRawDataExchangeMode();
181 return Protocol::Udp;
184 return Protocol::Tcp;
198 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
214 SCAN_PACKET_TYPE actual = ((
RawDataSensor*)_sensor)->GetDataPacketType();
215 if (actual == DISTANCE) {
216 return ScanPacketType::Distance;
219 return ScanPacketType::DistanceAndIntensity;
233 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
249 SensorResolutionFrequencyEnum actual = ((
RawDataSensor*)_sensor)->GetAngularResolution();
264 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
280 SCANNING_DIRECTION actual = ((
RawDataSensor*)_sensor)->GetScanningDirection();
281 if (actual == CLOCKWISE) {
282 return ScanningDirection::Clockwise;
285 return ScanningDirection::CounterClockwise;
299 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
319 toReturn->Stop = actual.
GetStop();
334 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
363 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
392 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
411 toReturn->Error = actual.
GetError();
427 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
463 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
490 toReturn->ProductTypeIdentification = ProductIdentification::RawData;
493 toReturn->ProductTypeIdentification = ProductIdentification::Navigation;
496 toReturn->ProductTypeIdentification = ProductIdentification::AntiCollision;
499 toReturn->ProductTypeIdentification = ProductIdentification::Rod300;
502 toReturn->ProductTypeIdentification = ProductIdentification::Rod500;
505 toReturn->ProductTypeIdentification = ProductIdentification::Rod120;
508 toReturn->ProductTypeIdentification = ProductIdentification::Rod130;
511 toReturn->ProductTypeIdentification = ProductIdentification::Unknown;
529 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
558 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
574 vector<RawDataError> actual = ((
RawDataSensor*)_sensor)->GetErrorLog();
575 List<WRawDataError^>^ toReturn = gcnew List<WRawDataError^>();
577 for (
int i = 0; i < actual.size(); i++) {
579 toAdd->
ErrorCode = actual[i].GetErrorCode();
580 toAdd->ErrorDate = actual[i].GetErrorDate();
582 toReturn->Add(toAdd);
598 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
633 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
653 toReturn->Led2 = (LedColor)actual.
GetLed2();
654 toReturn->Led3 = (LedColor)actual.
GetLed3();
655 toReturn->Led4 = (LedColor)actual.
GetLed4();
670 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
700 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
718 return gcnew String(actual.c_str());
731 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
747 FILTER_STATUS actual = ((
RawDataSensor*)_sensor)->GetFilterStatus();
748 if (actual == FILTER_OFF) {
749 return FilterStatus::Off;
752 return FilterStatus::On;
766 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
781 WINDOW_CALIBRATION actual = ((
RawDataSensor*)_sensor)->GetWindowCalibrationStatus();
782 if (actual == PROCESSING) {
783 return WindowCalibrationStatus::Processing;
785 else if (actual == DONE) {
786 return WindowCalibrationStatus::Done;
789 return WindowCalibrationStatus::Failed;
803 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
833 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
851 if (pProtocol == Protocol::Tcp) {
870 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
887 SCAN_PACKET_TYPE toSet = -1;
888 if (pPacketType == ScanPacketType::Distance) {
892 toSet = DISTANCE_INTENSITY;
907 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
924 SensorResolutionFrequencyEnum toSet =
static_cast<SensorResolutionFrequencyEnum
>(pResolution);
939 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
956 SCANNING_DIRECTION toSet = -1;
957 if (pScanDirection == ScanningDirection::Clockwise) {
961 toSet = COUNTER_CLOCKWISE;
976 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1006 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1036 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1067 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1097 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1127 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1157 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1174 FILTER_STATUS toSet = -1;
1175 if (pFilterStatus == FilterStatus::Off) {
1194 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1222 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1241 toReturn->Angles = gcnew cli::array<double>(data.
_scanCount);
1242 toReturn->Distances = gcnew cli::array<double>(data.
_scanCount);
1243 toReturn->Intensities = gcnew cli::array<double>(data.
_scanCount);
1245 toReturn->Timestamps = gcnew cli::array<double>(data.
_scanCount);
1257 Marshal::Copy(IntPtr((
void*)data.
_angles), toReturn->Angles, 0, data.
_scanCount);
1270 double* dummy = (
double*)malloc(data.
_scanCount *
sizeof(
double));
1272 Marshal::Copy(IntPtr((
void*)dummy), toReturn->Intensities, 0, data.
_scanCount);
1296 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1325 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1354 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1368 for (
int i = 0; i < pResult.
GetReasons().size(); i++) {
1369 toReturn->PushReason(gcnew String(pResult.
GetReasons()[i].c_str()));
Definition WAvailableResolution.h:7
Definition WBadAcknowledgmentException.h:3
Definition WBaseCommunication.h:16
ScanningDirection
Definition WEnums.h:9
FilterStatus
Definition WEnums.h:10
ScanPacketType
Definition WEnums.h:7
DataAvailabilityEnum
Definition WEnums.h:27
WindowCalibrationStatus
Definition WEnums.h:11
AngularResolution
Definition WEnums.h:8
Protocol
Definition WEnums.h:6
ChannelTypeEnum
Definition WEnums.h:26
ConnectionStatusEnum
Definition WEnums.h:25
Definition WEthernetCommunication.h:5
A wrapper on the RawData data encapsulation.
Definition WRawData.h:5
Helper to encapsulate the Angle range data.
Definition RawDataSensor/AngleRange.h:13
int GetStart()
Gets the start angle.
Definition AngleRange.cpp:7
int GetStop()
Gets the stop angle.
Definition AngleRange.cpp:25
Helper to encapsulate the contamination threshold.
Definition RawDataSensor/ContaminationStatus.h:12
unsigned int GetDataRight()
Gets the contamination status on sensor's right side.
Definition ContaminationStatus.cpp:40
unsigned int GetDataMiddle()
Gets the contamination status on sensor's middle side.
Definition ContaminationStatus.cpp:24
unsigned int GetDataLeft()
Gets the contamination status on sensor's left side.
Definition ContaminationStatus.cpp:8
Helper to encapsulate the contamination threshold.
Definition RawDataSensor/ContaminationThreshold.h:12
unsigned int GetWarning()
Gets the warning status.
Definition ContaminationThreshold.cpp:8
unsigned int GetError()
Gets the error status.
Definition ContaminationThreshold.cpp:26
Helper to encapsulate the network information.
Definition RawDataSensor/NetworkInformation.h:15
string GetSubnetMask()
Gets the subnet mask.
Definition NetworkInformation.cpp:62
string GetGateway()
Gets the gateway Address.
Definition NetworkInformation.cpp:44
bool GetDhcpMode()
Gets the dhcp mode.
Definition NetworkInformation.cpp:80
string GetIpAddress()
Gets the IP v4 Address.
Definition NetworkInformation.cpp:8
string GetMacAddress()
Get the sensor's mac adress.
Definition NetworkInformation.cpp:98
int GetIpPort()
Gets the tcp/ip comm port.
Definition NetworkInformation.cpp:26
Definition of the Raw data sensor services. This header will let the programmer to handle all the req...
Definition RawDataSensor/RawDataSensor.h:65
Helper to encapsulate the sensor lamps state.
Definition RawDataSensor/SensorLamps.h:20
LEDCOLOR GetLed4()
Gets the LED4 status.
Definition SensorLamps.cpp:84
LEDCOLOR GetLed3()
Gets the LED3 status.
Definition SensorLamps.cpp:66
LEDCOLOR GetLed2()
Gets the LED2 status.
Definition SensorLamps.cpp:48
LEDCOLOR GetLed1()
Gets the LED1 status.
Definition SensorLamps.cpp:30
Helper to encapsulate the sensor leds state.
Definition RawDataSensor/SensorLeds.h:11
bool GetLogoLed()
Gets the logo led.
Definition SensorLeds.cpp:44
bool GetStatusLed()
Gets the status led.
Definition SensorLeds.cpp:26
A wrapper on the AngleRange data encapsulation.
Definition WAngleRange.h:7
property int Start
Definition WAngleRange.h:21
Definition WContaminationStatus.h:4
property int DataLeft
Definition WContaminationStatus.h:21
A wrapper on the ContaminationThreshold data encapsulation.
Definition WContaminationThreshold.h:7
property int Warning
Definition WContaminationThreshold.h:23
A wrapper on the NetworkInformation data encapsulation.
Definition WNetworkInformation.h:14
property String IpAddress
Definition WNetworkInformation.h:34
A wrapper on the RawDataError data encapsulation.
Definition WRawDataError.h:7
property int ErrorCode
Definition WRawDataError.h:23
This class is a wrapper around the unmanaged code RawDataSensor. The goal of this classe is make acce...
Definition WRawDataSensor.h:36
WConfigurationResult SetFilterStatus(FilterStatus pFilterStatus)
Sets the device's filter status.
Definition WRawDataSensor.h:1172
WConfigurationResult SetNetworkInformation(WNetworkInformation^ pNetwork)
Set the overall network information except IP v4 and Port.
Definition WRawDataSensor.h:818
WConfigurationResult SetDeviceName(String^ pName)
Sets the sensor's name.
Definition WRawDataSensor.h:1142
String GetDeviceName()
Gets the sensor's name.
Definition WRawDataSensor.h:714
Protocol GetRawDataExchangeMode()
Get the raw data exchange mode.
Definition WRawDataSensor.h:177
void StopMdi()
Request the sensor to stop sending MDI data to host.
Definition WRawDataSensor.h:1338
WConfigurationResult SetContaminationThreshold(WContaminationThreshold^ pContaminationThreshold)
Sets the contamination level threshold for warning and error.
Definition WRawDataSensor.h:1082
int GetTemperature()
Gets the temperature.
Definition WRawDataSensor.h:543
unsigned int GetImmunityLevel()
Gets the immunity level.
Definition WRawDataSensor.h:377
WRawDataSensor(WBaseCommunication^ pcomm)
Definition WRawDataSensor.h:42
ScanningDirection GetScanningDirection()
Gets the scanning direction.
Definition WRawDataSensor.h:278
WAngleRange GetAngleRange()
Gets the angle range.
Definition WRawDataSensor.h:313
WConfigurationResult SetSensorLeds(WSensorLeds^ pLeds)
Sets the sensors external leds status (ON or OFF)
Definition WRawDataSensor.h:1112
void StartWindowCalibrationStatus()
Starts the window calibration status.
Definition WRawDataSensor.h:1207
WRawData RetrieveRawData()
Definition WRawDataSensor.h:1233
WConfigurationResult SetImmunityLevel(int pImmunityLevel)
Sets the sensor's immunity level.
Definition WRawDataSensor.h:1052
WConfigurationResult SetAngularResolution(AngularResolution pResolution)
Sets the angle resolution. Can be either AngularResolution::ZeroToZeroPointOneAtFourtyHz or AngularRe...
Definition WRawDataSensor.h:922
WSensorLeds GetSensorLeds()
Gets the sensor's leds status.
Definition WRawDataSensor.h:612
long GetRuntimeHours()
Gets the sensor runtime hours.
Definition WRawDataSensor.h:684
WCommunicationStatus Initialize() override
Initializes the object to connect the sensor.
Definition WRawDataSensor.h:54
WNetworkInformation GetNetworkInformation()
Gets whole data information.
Definition WRawDataSensor.h:138
WConfigurationResult toManagedInstance(ConfigurationResult pResult)
Definition WRawDataSensor.h:1365
WConfigurationResult SetScanningDirection(ScanningDirection pScanDirection)
Sets the scanning direction. Can be either ScanningDirection::Clockwise or ScanningDirection::Counter...
Definition WRawDataSensor.h:954
ScanPacketType GetDataPacketType()
Gets the data packed type.
Definition WRawDataSensor.h:212
void ResetDevice()
Resets the device.
Definition WRawDataSensor.h:79
WConfigurationResult SetDataPacketType(ScanPacketType pPacketType)
Sets the packet type returned in raw data. Can be either ScanPacketType::Distance or ScanPacketType::...
Definition WRawDataSensor.h:885
~WRawDataSensor()
Definition WRawDataSensor.h:47
WindowCalibrationStatus GetWindowCalibrationStatus()
Gets the window calibration status.
Definition WRawDataSensor.h:779
WContaminationThreshold GetContaminationThreshold()
Gets the contamination threshold.
Definition WRawDataSensor.h:406
WConfigurationResult SetRawDataExchangeMode(Protocol pProtocol)
Sets the RAW data exchange mode. Can be either TCP or UDP.
Definition WRawDataSensor.h:848
void SendMdi()
Request the sensor to start sending MDI data to host.
Definition WRawDataSensor.h:1309
List< WRawDataError^> GetErrorLog()
Gets the error log.
Definition WRawDataSensor.h:572
FilterStatus GetFilterStatus()
Gets the filter status.
Definition WRawDataSensor.h:745
WContaminationStatus GetContaminationStatus()
Gets the contamination status.
Definition WRawDataSensor.h:441
void RebootDevice()
Reboots the device.
Definition WRawDataSensor.h:107
WSoftwareVersion GetVersion() override
Gets the sensor version data.
Definition WRawDataSensor.h:477
WRawDataSensor()
Definition WRawDataSensor.h:38
AngularResolution GetAngularResolution()
Gets the angular resolution.
Definition WRawDataSensor.h:247
WConfigurationResult SetSkipScan(int pSkipScan)
Sets the skip scan.
Definition WRawDataSensor.h:1021
unsigned int GetSkipScan()
Gets the skip scan.
Definition WRawDataSensor.h:348
WConfigurationResult SetAngleRange(WAngleRange^ pAngleRange)
Sets the Angle range (start and stop)
Definition WRawDataSensor.h:991
WSensorLamps GetSensorLamps()
Gets the sensor lamps status.
Definition WRawDataSensor.h:647
A wrapper on the SensorLamps data encapsulation.
Definition WSensorLamps.h:11
property LedColor Led1
Definition WSensorLamps.h:29
A wrapper on the SensorLeds data encapsulation.
Definition WSensorLeds.h:8
property bool StatusLed
Definition WSensorLeds.h:24
Helper to encapsulate the software version.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/RawDataSensor/SoftwareVersion.h:19
unsigned int GetRevision()
Gets the internal software revision.
Definition SoftwareVersion.cpp:26
unsigned int GetPrototype()
Gets the internal prototype code.
Definition SoftwareVersion.cpp:44
unsigned int GetVersion()
Gets the internal software version.
Definition SoftwareVersion.cpp:8
PRODUCT_IDENTIFICATION GetProductIdentification()
Gets the product identification.
Definition SoftwareVersion.cpp:113
unsigned long GetPartNumber()
Gets the internal part number.
Definition SoftwareVersion.cpp:95
unsigned long GetCanNumber()
Gets the internal CAN number.
Definition SoftwareVersion.cpp:63
unsigned int GetHardwareVersion()
Gets the Hardware version.
Definition SoftwareVersion.cpp:80
An Exception used when a bad acknowledgment error is detected.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/BadAcknowledgmentException.h:14
virtual const char * what() const noexcept
Overload of message retrie.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/BadAcknowledgmentException.h:39
An Exception used when a communication error is detected.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/CommunicationException.h:14
Helper to encapsulate the configuration result.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/ConfigurationResult.h:15
bool GetResult()
Gets the result.
Definition ConfigurationResult.cpp:33
vector< string > GetReasons()
Gets the reason of failure.
Definition ConfigurationResult.cpp:42
The base class encapsulating sensor's RAW data.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:14
double * _angles
Angles array (FREE the pointer after usage !!!)
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:35
double * _distances
Distances array (FREE the pointer after usage !!!)
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:27
int * _indexes
The index of the record starting from 1 (FREE the pointer after usage !!!)
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:19
double * _intensities
Intensities array (FREE the pointer after usage !!!)
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:31
double * _timestamps
The reading timestamps elapsed from the StartMdi command expressed in nanoseconds (FREE the pointer a...
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:23
int _scanCount
Scan counts.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/RawData.h:39
An exception used when the sensor returns an error related to a command excecution.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/SensorErrorException.h:13
An Exception used when a thread creation error is detected.
Definition RodConfigSoftware_Samples/RODConfigSoftwareSamples/includes/Toolbox/ThreadCreationException.h:15
std::string ErrorMeaning
Definition CommunicationStructures.h:16
int ErrorCode
Definition CommunicationStructures.h:15
Definition CommunicationStructures.h:24
ConnectionState Status
Definition CommunicationStructures.h:26
vector< Channel > Channels
Definition CommunicationStructures.h:25
CommErrorCode ErrorCode
Definition CommunicationStructures.h:27
Definition WBadAcknowledgmentException.h:6
property ChannelTypeEnum Type
Definition WChannel.h:22
Definition WCommunicationErrorCode.h:6
Definition WCommunicationException.h:6
property int ErrorCode
Definition WCommunicationException.h:12
Definition WCommunicationStatus.h:16
property List< WChannel^> Channels
Definition WCommunicationStatus.h:24
A wrapper on the ConfigurationResult data encapsulation.
Definition WConfigurationResult.h:16
property bool Result
Definition WConfigurationResult.h:30
property cli::array< int > Indexes
Definition WRawData.h:21
Definition WSensorException.h:6
property String ErrorCode
Definition WSensorException.h:12
A wrapper on the SoftwareVersion data encapsulation.
Definition WSoftwareVersion.h:12
property int Version
Definition WSoftwareVersion.h:32
Definition WThreadCreationException.h:6
static char * ConvertToNativeString(String^ toConvert)
Definition WUtilities.h:16