2#include <RawDataSensor.h>
3#include "WNetworkInformation.h"
4#include "WAngleRange.h"
5#include "WContaminationThreshold.h"
6#include "WSoftwareVersion.h"
7#include "WRawDataError.h"
9#include "WSensorLeds.h"
10#include "WSensorLamps.h"
12#include <BadAcknowledgmentException.h>
13#include <CommunicationException.h>
14#include <SensorErrorException.h>
15#include <ThreadCreationException.h>
16#include "WContaminationStatus.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;
55 _sensor->Initialize();
77 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
105 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
127 toReturn->Gateway = gcnew String(toFetch.
GetGateway().c_str());
130 toReturn->SubnetMask = gcnew String(toFetch.
GetSubnetMask().c_str());
146 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
162 PROTOCOL actual = ((
RawDataSensor*)_sensor)->GetRawDataExchangeMode();
164 return Protocol::Udp;
167 return Protocol::Tcp;
181 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
197 SCAN_PACKET_TYPE actual = ((
RawDataSensor*)_sensor)->GetDataPacketType();
198 if (actual == DISTANCE) {
199 return ScanPacketType::Distance;
202 return ScanPacketType::DistanceAndIntensity;
216 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
232 ANGULAR_RESOLUTION actual = ((
RawDataSensor*)_sensor)->GetAngularResolution();
233 if (actual == ZERO_TO_ZERO_POINT_ONE_AT_FOURTY_HZ) {
234 return AngularResolution::ZeroToZeroPointOneAtFourtyHz;
237 return AngularResolution::ZeroToZeroPointTwoAtEightyHz;
251 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
267 SCANNING_DIRECTION actual = ((
RawDataSensor*)_sensor)->GetScanningDirection();
268 if (actual == CLOCKWISE) {
269 return ScanningDirection::Clockwise;
272 return ScanningDirection::CounterClockwise;
286 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
306 toReturn->Stop = actual.
GetStop();
321 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
350 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
379 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
398 toReturn->Error = actual.
GetError();
414 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
450 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
477 toReturn->ProductTypeIdentification = ProductIdentification::RawData;
480 toReturn->ProductTypeIdentification = ProductIdentification::Navigation;
483 toReturn->ProductTypeIdentification = ProductIdentification::AntiCollision;
486 toReturn->ProductTypeIdentification = ProductIdentification::Unknown;
504 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
533 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
549 vector<RawDataError> actual = ((
RawDataSensor*)_sensor)->GetErrorLog();
550 List<WRawDataError^>^ toReturn = gcnew List<WRawDataError^>();
552 for (
int i = 0; i < actual.size(); i++) {
554 toAdd->
ErrorCode = actual[i].GetErrorCode();
555 toAdd->ErrorDate = actual[i].GetErrorDate();
557 toReturn->Add(toAdd);
573 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
608 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
628 toReturn->Led2 = (LedColor)actual.
GetLed2();
629 toReturn->Led3 = (LedColor)actual.
GetLed3();
630 toReturn->Led4 = (LedColor)actual.
GetLed4();
645 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
675 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
693 return gcnew String(actual.c_str());
706 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
722 FILTER_STATUS actual = ((
RawDataSensor*)_sensor)->GetFilterStatus();
723 if (actual == FILTER_OFF) {
724 return FilterStatus::Off;
727 return FilterStatus::On;
741 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
756 WINDOW_CALIBRATION actual = ((
RawDataSensor*)_sensor)->GetWindowCalibrationStatus();
757 if (actual == PROCESSING) {
758 return WindowCalibrationStatus::Processing;
760 else if (actual == DONE) {
761 return WindowCalibrationStatus::Done;
764 return WindowCalibrationStatus::Failed;
778 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
808 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
838 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
868 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
886 if (pProtocol == Protocol::Tcp) {
905 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
922 SCAN_PACKET_TYPE toSet = -1;
923 if (pPacketType == ScanPacketType::Distance) {
927 toSet = DISTANCE_INTENSITY;
942 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
959 ANGULAR_RESOLUTION toSet = -1;
960 if (pResolution == AngularResolution::ZeroToZeroPointOneAtFourtyHz) {
961 toSet = ZERO_TO_ZERO_POINT_ONE_AT_FOURTY_HZ;
964 toSet = ZERO_TO_ZERO_POINT_TWO_AT_EIGHTY_HZ;
979 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
996 SCANNING_DIRECTION toSet = -1;
997 if (pScanDirection == ScanningDirection::Clockwise) {
1001 toSet = COUNTER_CLOCKWISE;
1016 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1046 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1076 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1107 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1137 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1167 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1197 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1214 FILTER_STATUS toSet = -1;
1215 if (pFilterStatus == FilterStatus::Off) {
1234 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1262 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1281 toReturn->Angles = gcnew cli::array<double>(data.
_scanCount);
1282 toReturn->Distances = gcnew cli::array<double>(data.
_scanCount);
1283 toReturn->Intensities = gcnew cli::array<double>(data.
_scanCount);
1285 toReturn->Timestamps = gcnew cli::array<double>(data.
_scanCount);
1297 Marshal::Copy(IntPtr((
void*)data.
_angles), toReturn->Angles, 0, data.
_scanCount);
1310 double* dummy = (
double*)malloc(data.
_scanCount *
sizeof(
double));
1312 Marshal::Copy(IntPtr((
void*)dummy), toReturn->Intensities, 0, data.
_scanCount);
1336 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1365 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1394 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1408 for (
int i = 0; i < pResult.
GetReasons().size(); i++) {
1409 toReturn->PushReason(gcnew String(pResult.
GetReasons()[i].c_str()));
Definition WBadAcknowledgmentException.h:3
Definition WBaseCommunication.h:25
ScanningDirection
Definition WEnums.h:7
FilterStatus
Definition WEnums.h:8
ScanPacketType
Definition WEnums.h:5
WindowCalibrationStatus
Definition WEnums.h:9
AngularResolution
Definition WEnums.h:6
Protocol
Definition WEnums.h:4
Definition WEthernetCommunication.h:5
A wrapper on the RawData data encapsulation.
Definition WRawData.h:5
Definition WUtilities.h:12
Helper to encapsulate the Angle range data.
Definition 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 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 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 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
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.h:61
Helper to encapsulate the sensor lamps state.
Definition 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 SensorLeds.h:11
bool GetLogoLed()
Gets the logo led.
Definition SensorLeds.cpp:44
bool GetStatusLed()
Gets the status led.
Definition SensorLeds.cpp:26
Helper to encapsulate the software version.
Definition 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
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
WSoftwareVersion GetVersion()
Gets the sensor version data.
Definition WRawDataSensor.h:464
WConfigurationResult SetFilterStatus(FilterStatus pFilterStatus)
Sets the device's filter status.
Definition WRawDataSensor.h:1212
WConfigurationResult SetNetworkInformation(WNetworkInformation^ pNetwork)
Set the overall network information except IP v4 and Port.
Definition WRawDataSensor.h:853
WConfigurationResult SetDeviceName(String^ pName)
Sets the sensor's name.
Definition WRawDataSensor.h:1182
void Initialize() override
Initializes the object to connect the sensor.
Definition WRawDataSensor.h:54
String GetDeviceName()
Gets the sensor's name.
Definition WRawDataSensor.h:689
Protocol GetRawDataExchangeMode()
Get the raw data exchange mode.
Definition WRawDataSensor.h:160
void StopMdi()
Request the sensor to stop sending MDI data to host.
Definition WRawDataSensor.h:1378
WConfigurationResult SetIpPort(int pPort)
Sets the IP port of the sensor.
Definition WRawDataSensor.h:823
WConfigurationResult SetContaminationThreshold(WContaminationThreshold^ pContaminationThreshold)
Sets the contamination level threshold for warning and error.
Definition WRawDataSensor.h:1122
int GetTemperature()
Gets the temperature.
Definition WRawDataSensor.h:518
unsigned int GetImmunityLevel()
Gets the immunity level.
Definition WRawDataSensor.h:364
WRawDataSensor(WBaseCommunication^ pcomm)
Definition WRawDataSensor.h:42
ScanningDirection GetScanningDirection()
Gets the scanning direction.
Definition WRawDataSensor.h:265
WAngleRange GetAngleRange()
Gets the angle range.
Definition WRawDataSensor.h:300
WConfigurationResult SetSensorLeds(WSensorLeds^ pLeds)
Sets the sensors external leds status (ON or OFF)
Definition WRawDataSensor.h:1152
void StartWindowCalibrationStatus()
Starts the window calibration status.
Definition WRawDataSensor.h:1247
WRawData RetrieveRawData()
Definition WRawDataSensor.h:1273
WConfigurationResult SetImmunityLevel(int pImmunityLevel)
Sets the sensor's immunity level.
Definition WRawDataSensor.h:1092
WConfigurationResult SetAngularResolution(AngularResolution pResolution)
Sets the angle resolution. Can be either AngularResolution::ZeroToZeroPointOneAtFourtyHz or AngularRe...
Definition WRawDataSensor.h:957
WSensorLeds GetSensorLeds()
Gets the sensor's leds status.
Definition WRawDataSensor.h:587
long GetRuntimeHours()
Gets the sensor runtime hours.
Definition WRawDataSensor.h:659
WNetworkInformation GetNetworkInformation()
Gets whole data information.
Definition WRawDataSensor.h:121
WConfigurationResult toManagedInstance(ConfigurationResult pResult)
Definition WRawDataSensor.h:1405
WConfigurationResult SetScanningDirection(ScanningDirection pScanDirection)
Sets the scanning direction. Can be either ScanningDirection::Clockwise or ScanningDirection::Counter...
Definition WRawDataSensor.h:994
ScanPacketType GetDataPacketType()
Gets the data packed type.
Definition WRawDataSensor.h:195
void ResetDevice()
Resets the device.
Definition WRawDataSensor.h:62
WConfigurationResult SetDataPacketType(ScanPacketType pPacketType)
Sets the packet type returned in raw data. Can be either ScanPacketType::Distance or ScanPacketType::...
Definition WRawDataSensor.h:920
~WRawDataSensor()
Definition WRawDataSensor.h:47
WindowCalibrationStatus GetWindowCalibrationStatus()
Gets the window calibration status.
Definition WRawDataSensor.h:754
WContaminationThreshold GetContaminationThreshold()
Gets the contamination threshold.
Definition WRawDataSensor.h:393
WConfigurationResult SetRawDataExchangeMode(Protocol pProtocol)
Sets the RAW data exchange mode. Can be either TCP or UDP.
Definition WRawDataSensor.h:883
void SendMdi()
Request the sensor to start sending MDI data to host.
Definition WRawDataSensor.h:1349
List< WRawDataError^> GetErrorLog()
Gets the error log.
Definition WRawDataSensor.h:547
FilterStatus GetFilterStatus()
Gets the filter status.
Definition WRawDataSensor.h:720
WConfigurationResult SetIpAddress(String^ pIpAddress)
Sets the IP v4 address of the sensor.
Definition WRawDataSensor.h:793
WContaminationStatus GetContaminationStatus()
Gets the contamination status.
Definition WRawDataSensor.h:428
void RebootDevice()
Reboots the device.
Definition WRawDataSensor.h:90
WRawDataSensor()
Definition WRawDataSensor.h:38
AngularResolution GetAngularResolution()
Gets the angular resolution.
Definition WRawDataSensor.h:230
WConfigurationResult SetSkipScan(int pSkipScan)
Sets the skip scan.
Definition WRawDataSensor.h:1061
unsigned int GetSkipScan()
Gets the skip scan.
Definition WRawDataSensor.h:335
WConfigurationResult SetAngleRange(WAngleRange^ pAngleRange)
Sets the Angle range (start and stop)
Definition WRawDataSensor.h:1031
WSensorLamps GetSensorLamps()
Gets the sensor lamps status.
Definition WRawDataSensor.h:622
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
A wrapper on the SoftwareVersion data encapsulation.
Definition WSoftwareVersion.h:10
property int Version
Definition WSoftwareVersion.h:30
An Exception used when a bad acknowledgment error is detected.
Definition BadAcknowledgmentException.h:14
virtual const char * what() const noexcept
Overload of message retrie.
Definition BadAcknowledgmentException.h:39
An Exception used when a communication error is detected.
Definition CommunicationException.h:14
Helper to encapsulate the configuration result.
Definition 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 RawData.h:14
int * _indexes
The index of the record starting from 1 (FREE the pointer after usage !!!)
Definition RawData.h:19
double * _angles
Angles array (FREE the pointer after usage !!!)
Definition RawData.h:35
double * _distances
Distances array (FREE the pointer after usage !!!)
Definition RawData.h:27
double * _timestamps
The reading timestamps elapsed from the StartMdi command expressed in nanoseconds (FREE the pointer a...
Definition RawData.h:23
int _scanCount
Scan counts.
Definition RawData.h:39
double * _intensities
Intensities array (FREE the pointer after usage !!!)
Definition RawData.h:31
An exception used when the sensor returns an error related to a command excecution.
Definition SensorErrorException.h:13
An Exception used when a thread creation error is detected.
Definition ThreadCreationException.h:15
Definition WBadAcknowledgmentException.h:6
Definition WCommunicationException.h:6
property int ErrorCode
Definition WCommunicationException.h:12
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
Definition WThreadCreationException.h:6
static char * ConvertToNativeString(String^ toConvert)
Definition WUtilities.h:16