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>
16#include "../StarfleetToolboxWrapper/WCommunicationStatus.h"
17#include "../StarfleetToolboxWrapper/WContaminationStatus.h"
19#pragma make_public(ConfigurationResult)
21using namespace System::Collections;
22using namespace System::Collections::Generic;
28using namespace System::Runtime::InteropServices;
44 _sensor = (BaseSensor*)
new RawDataSensor(pcomm->__nativeCommunication);
45 Communication = pcomm;
59 for (
int i = 0; i < status.
Channels.size(); i++) {
95 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
123 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
145 toReturn->Gateway = gcnew String(toFetch.
GetGateway().c_str());
148 toReturn->SubnetMask = gcnew String(toFetch.
GetSubnetMask().c_str());
149 toReturn->MacAddress = gcnew String(toFetch.
GetMacAddress().c_str());
164 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
180 PROTOCOL actual = ((
RawDataSensor*)_sensor)->GetRawDataExchangeMode();
182 return Protocol::Udp;
185 return Protocol::Tcp;
199 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
215 SCAN_PACKET_TYPE actual = ((
RawDataSensor*)_sensor)->GetDataPacketType();
216 if (actual == DISTANCE) {
217 return ScanPacketType::Distance;
220 return ScanPacketType::DistanceAndIntensity;
234 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
250 SensorResolutionFrequencyEnum actual = ((
RawDataSensor*)_sensor)->GetAngularResolution();
265 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
281 SCANNING_DIRECTION actual = ((
RawDataSensor*)_sensor)->GetScanningDirection();
282 if (actual == CLOCKWISE) {
283 return ScanningDirection::Clockwise;
286 return ScanningDirection::CounterClockwise;
300 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
320 toReturn->Stop = actual.
GetStop();
335 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
364 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
393 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
412 toReturn->Error = actual.
GetError();
428 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
455 toReturn->ProductTypeIdentification = ProductIdentification::RawData;
458 toReturn->ProductTypeIdentification = ProductIdentification::Navigation;
461 toReturn->ProductTypeIdentification = ProductIdentification::AntiCollision;
464 toReturn->ProductTypeIdentification = ProductIdentification::Rod300;
467 toReturn->ProductTypeIdentification = ProductIdentification::Rod500;
470 toReturn->ProductTypeIdentification = ProductIdentification::Rod120;
473 toReturn->ProductTypeIdentification = ProductIdentification::Rod130;
476 toReturn->ProductTypeIdentification = ProductIdentification::Unknown;
494 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
510 unsigned int platformVersion = ((
RawDataSensor*)_sensor)->GetPlatformVersion();
512 return platformVersion;
525 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
554 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
570 vector<RawDataError> actual = ((
RawDataSensor*)_sensor)->GetErrorLog();
571 List<WRawDataError^>^ toReturn = gcnew List<WRawDataError^>();
573 for (
int i = 0; i < actual.size(); i++) {
575 toAdd->
ErrorCode = actual[i].GetErrorCode();
576 toAdd->ErrorDate = actual[i].GetErrorDate();
578 toReturn->Add(toAdd);
594 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
629 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
649 toReturn->Led2 = (LedColor)actual.
GetLed2();
650 toReturn->Led3 = (LedColor)actual.
GetLed3();
651 toReturn->Led4 = (LedColor)actual.
GetLed4();
666 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
696 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
714 return gcnew String(actual.c_str());
727 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
743 FILTER_STATUS actual = ((
RawDataSensor*)_sensor)->GetFilterStatus();
744 if (actual == FILTER_OFF) {
745 return FilterStatus::Off;
748 return FilterStatus::On;
762 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
777 WINDOW_CALIBRATION actual = ((
RawDataSensor*)_sensor)->GetWindowCalibrationStatus();
778 if (actual == PROCESSING) {
779 return WindowCalibrationStatus::Processing;
781 else if (actual == DONE) {
782 return WindowCalibrationStatus::Done;
785 return WindowCalibrationStatus::Failed;
799 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
829 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
847 if (pProtocol == Protocol::Tcp) {
866 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
883 SCAN_PACKET_TYPE toSet = -1;
884 if (pPacketType == ScanPacketType::Distance) {
888 toSet = DISTANCE_INTENSITY;
903 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
920 SensorResolutionFrequencyEnum toSet =
static_cast<SensorResolutionFrequencyEnum
>(pResolution);
935 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
952 SCANNING_DIRECTION toSet = -1;
953 if (pScanDirection == ScanningDirection::Clockwise) {
957 toSet = COUNTER_CLOCKWISE;
972 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1002 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1032 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1063 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1093 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1123 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1153 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1170 FILTER_STATUS toSet = -1;
1171 if (pFilterStatus == FilterStatus::Off) {
1190 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1218 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1237 toReturn->Angles = gcnew cli::array<double>(data.
_scanCount);
1238 toReturn->Distances = gcnew cli::array<double>(data.
_scanCount);
1239 toReturn->Intensities = gcnew cli::array<double>(data.
_scanCount);
1241 toReturn->Timestamps = gcnew cli::array<double>(data.
_scanCount);
1253 Marshal::Copy(IntPtr((
void*)data.
_angles), toReturn->Angles, 0, data.
_scanCount);
1266 double* dummy = (
double*)malloc(data.
_scanCount *
sizeof(
double));
1268 Marshal::Copy(IntPtr((
void*)dummy), toReturn->Intensities, 0, data.
_scanCount);
1292 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1321 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1350 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1372 toReturn->Z1 = toFetch.
GetZ1();
1373 toReturn->Z2 = toFetch.
GetZ2();
1374 toReturn->Z3 = toFetch.
GetZ3();
1375 toReturn->Z4 = toFetch.
GetZ4();
1376 toReturn->Z5 = toFetch.
GetZ5();
1377 toReturn->Z6 = toFetch.
GetZ6();
1378 toReturn->Z7 = toFetch.
GetZ7();
1379 toReturn->Z8 = toFetch.
GetZ8();
1380 toReturn->Z9 = toFetch.
GetZ9();
1395 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
1410 for (
int i = 0; i < pResult.
GetReasons().size(); i++) {
1411 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:28
WindowCalibrationStatus
Definition WEnums.h:11
AngularResolution
Definition WEnums.h:8
Protocol
Definition WEnums.h:6
ChannelTypeEnum
Definition WEnums.h:27
ConnectionStatusEnum
Definition WEnums.h:26
Definition WEthernetCommunication.h:5
A wrapper on the RawData data encapsulation.
Definition WRawData.h:5
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 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
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.h:65
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
A wrapper on the AngleRange data encapsulation.
Definition WAngleRange.h:7
property int Start
Definition WAngleRange.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:37
int GetTemperature() override
Gets the temperature.
Definition WRawDataSensor.h:539
WConfigurationResult SetFilterStatus(FilterStatus pFilterStatus)
Sets the device's filter status.
Definition WRawDataSensor.h:1168
WConfigurationResult SetNetworkInformation(WNetworkInformation^ pNetwork)
Set the overall network information except IP v4 and Port.
Definition WRawDataSensor.h:814
unsigned int GetPlatformVersion() override
Gets the platform version.
Definition WRawDataSensor.h:508
WContaminationStatus GetContaminationStatus() override
Gets the contamination status.
Definition WRawDataSensor.h:1364
Protocol GetRawDataExchangeMode()
Get the raw data exchange mode.
Definition WRawDataSensor.h:178
void StopMdi()
Request the sensor to stop sending MDI data to host.
Definition WRawDataSensor.h:1334
String GetDeviceName() override
Gets the sensor's name.
Definition WRawDataSensor.h:710
WConfigurationResult SetContaminationThreshold(WContaminationThreshold^ pContaminationThreshold)
Sets the contamination level threshold for warning and error.
Definition WRawDataSensor.h:1078
unsigned int GetImmunityLevel()
Gets the immunity level.
Definition WRawDataSensor.h:378
WRawDataSensor(WBaseCommunication^ pcomm)
Definition WRawDataSensor.h:43
ScanningDirection GetScanningDirection()
Gets the scanning direction.
Definition WRawDataSensor.h:279
WAngleRange GetAngleRange()
Gets the angle range.
Definition WRawDataSensor.h:314
WConfigurationResult SetSensorLeds(WSensorLeds^ pLeds)
Sets the sensors external leds status (ON or OFF)
Definition WRawDataSensor.h:1108
void StartWindowCalibrationStatus()
Starts the window calibration status.
Definition WRawDataSensor.h:1203
WRawData RetrieveRawData()
Definition WRawDataSensor.h:1229
WConfigurationResult SetImmunityLevel(int pImmunityLevel)
Sets the sensor's immunity level.
Definition WRawDataSensor.h:1048
WConfigurationResult SetAngularResolution(AngularResolution pResolution)
Sets the angle resolution. Can be either AngularResolution::ZeroToZeroPointOneAtFourtyHz or AngularRe...
Definition WRawDataSensor.h:918
WSensorLeds GetSensorLeds()
Gets the sensor's leds status.
Definition WRawDataSensor.h:608
WCommunicationStatus Initialize() override
Initializes the object to connect the sensor.
Definition WRawDataSensor.h:55
long GetRuntimeHours() override
Gets the sensor runtime hours.
Definition WRawDataSensor.h:680
WNetworkInformation GetNetworkInformation()
Gets whole data information.
Definition WRawDataSensor.h:139
WConfigurationResult toManagedInstance(ConfigurationResult pResult)
Definition WRawDataSensor.h:1407
WConfigurationResult SetScanningDirection(ScanningDirection pScanDirection)
Sets the scanning direction. Can be either ScanningDirection::Clockwise or ScanningDirection::Counter...
Definition WRawDataSensor.h:950
WConfigurationResult SetDeviceName(String^ pName) override
Sets the sensor's name.
Definition WRawDataSensor.h:1138
ScanPacketType GetDataPacketType()
Gets the data packed type.
Definition WRawDataSensor.h:213
void ResetDevice()
Resets the device.
Definition WRawDataSensor.h:80
WConfigurationResult SetDataPacketType(ScanPacketType pPacketType)
Sets the packet type returned in raw data. Can be either ScanPacketType::Distance or ScanPacketType::...
Definition WRawDataSensor.h:881
~WRawDataSensor()
Definition WRawDataSensor.h:48
WindowCalibrationStatus GetWindowCalibrationStatus()
Gets the window calibration status.
Definition WRawDataSensor.h:775
WContaminationThreshold GetContaminationThreshold()
Gets the contamination threshold.
Definition WRawDataSensor.h:407
WConfigurationResult SetRawDataExchangeMode(Protocol pProtocol)
Sets the RAW data exchange mode. Can be either TCP or UDP.
Definition WRawDataSensor.h:844
void SendMdi()
Request the sensor to start sending MDI data to host.
Definition WRawDataSensor.h:1305
List< WRawDataError^> GetErrorLog()
Gets the error log.
Definition WRawDataSensor.h:568
FilterStatus GetFilterStatus()
Gets the filter status.
Definition WRawDataSensor.h:741
void RebootDevice()
Reboots the device.
Definition WRawDataSensor.h:108
WSoftwareVersion GetVersion() override
Gets the sensor version data.
Definition WRawDataSensor.h:442
WRawDataSensor()
Definition WRawDataSensor.h:39
AngularResolution GetAngularResolution()
Gets the angular resolution.
Definition WRawDataSensor.h:248
WConfigurationResult SetSkipScan(int pSkipScan)
Sets the skip scan.
Definition WRawDataSensor.h:1017
unsigned int GetSkipScan()
Gets the skip scan.
Definition WRawDataSensor.h:349
WConfigurationResult SetAngleRange(WAngleRange^ pAngleRange)
Sets the Angle range (start and stop)
Definition WRawDataSensor.h:987
WSensorLamps GetSensorLamps()
Gets the sensor lamps status.
Definition WRawDataSensor.h:643
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
An Exception used when a bad acknowledgment error is detected.
Definition BadAcknowledgmentException.h:15
virtual const char * what() const noexcept
Overload of message retrie.
Definition BadAcknowledgmentException.h:44
An Exception used when a communication error is detected.
Definition CommunicationException.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
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
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 GetZ3()
Gets the Navigation sensor's Z3 contamination state.
Definition ContaminationStatus.cpp:89
unsigned int GetDataMiddle()
Gets the contamination status on sensor's middle side.
Definition ContaminationStatus.cpp:24
unsigned int GetZ9()
Gets the Navigation sensor's Z9 contamination state.
Definition ContaminationStatus.cpp:188
unsigned int GetDataLeft()
Gets the contamination status on sensor's left side.
Definition ContaminationStatus.cpp:8
unsigned int GetZ8()
Gets the Navigation sensor's Z8 contamination state.
Definition ContaminationStatus.cpp:173
unsigned int GetZ5()
Gets the Navigation sensor's Z5 contamination state.
Definition ContaminationStatus.cpp:121
unsigned int GetZ2()
Gets the Navigation sensor's Z2 contamination state.
Definition ContaminationStatus.cpp:74
unsigned int GetZ1()
Gets the Navigation sensor's Z1 contamination state.
Definition ContaminationStatus.cpp:58
unsigned int GetZ6()
Gets the Navigation sensor's Z6 contamination state.
Definition ContaminationStatus.cpp:143
unsigned int GetZ7()
Gets the Navigation sensor's Z7 contamination state.
Definition ContaminationStatus.cpp:158
unsigned int GetZ4()
Gets the Navigation sensor's Z4 contamination state.
Definition ContaminationStatus.cpp:105
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:14
Helper to encapsulate the software version.
Definition SoftwareVersion.h:21
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 thread creation error is detected.
Definition ThreadCreationException.h:16
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
Definition WContaminationStatus.h:6
property int DataLeft
Definition WContaminationStatus.h:23
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