3#include <NavigationSensor.h>
4#include "WFilterType.h"
7#include <CommunicationException.h>
8#include <SensorErrorException.h>
9#include <ThreadCreationException.h>
10#include <BadAcknowledgmentException.h>
11#include <CommunicationException.h>
17using namespace System::Collections;
18using namespace System::Collections::Generic;
30 Communication = pcomm;
41 _sensor->Initialize();
50 toReturn->FilterTypeValue = FilterMode::Median;
53 toReturn->FilterTypeValue = FilterMode::Average;
56 toReturn->FilterTypeValue = FilterMode::Max;
61 toReturn->NumS = toFetch.
GetNumS();
76 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
90 switch (pFilterType->FilterTypeValue) {
91 case FilterMode::Median:
94 case FilterMode::Average:
103 toSet.
SetNumS(pFilterType->NumS);
118 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
134 ANGULAR_RESOLUTION actual = ((
NavigationSensor*)_sensor)->GetAngularResolution();
135 if (actual == ZERO_TO_ZERO_POINT_ONE_AT_FOURTY_HZ) {
136 return AngularResolution::ZeroToZeroPointOneAtFourtyHz;
138 else if (actual == ZERO_TO_ZERO_POINT_TWO_AT_EIGHTY_HZ) {
139 return AngularResolution::ZeroToZeroPointTwoAtEightyHz;
141 else if (actual == ZERO_TO_ZERO_POINT_ZERO_FIVE_AT_TWENTY_HZ) {
142 return AngularResolution::ZeroToZeroPointZeroFiveAtTwentyHz;
144 else if (actual == ZERO_TO_ZERO_POINT_ZERO_TWENTYFIVE_AT_TEN_HZ) {
145 return AngularResolution::ZeroToZeroPointZeroTwoFiveAtTenHz;
159 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
177 ANGULAR_RESOLUTION toSet = -1;
178 if (pResolution == AngularResolution::ZeroToZeroPointOneAtFourtyHz) {
179 toSet = ZERO_TO_ZERO_POINT_ONE_AT_FOURTY_HZ;
181 else if(pResolution == AngularResolution::ZeroToZeroPointTwoAtEightyHz) {
182 toSet = ZERO_TO_ZERO_POINT_TWO_AT_EIGHTY_HZ;
184 else if (pResolution == AngularResolution::ZeroToZeroPointZeroFiveAtTwentyHz) {
185 toSet = ZERO_TO_ZERO_POINT_ZERO_FIVE_AT_TWENTY_HZ;
187 else if (pResolution == AngularResolution::ZeroToZeroPointZeroTwoFiveAtTenHz) {
188 toSet = ZERO_TO_ZERO_POINT_ZERO_TWENTYFIVE_AT_TEN_HZ;
204 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
221 if (actual == CUSTOMIZE_LOGO_PAGE) {
222 return DisplayPageIndex::CustomLogoPage;
224 else if (actual == OPERATING_STATUS_PAGE) {
225 return DisplayPageIndex::OperatingStatus;
227 else if (actual == WMS_STATUS_PAGE) {
228 return DisplayPageIndex::WmsStatus;
230 else if (actual == ETH_USB_CONNECT_STATUS_PAGE) {
231 return DisplayPageIndex::EthUsbConnectStatus;
233 else if (actual == NETWORK_INFORMATION_PAGE) {
234 return DisplayPageIndex::NetworkInfo;
236 else if (actual == BLUETHOOT_CONNECTION_PAGE) {
237 return DisplayPageIndex::BluethootConnection;
251 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
268 PAGE_INDEX toSet = -1;
269 if (pPageIndex == DisplayPageIndex::CustomLogoPage) {
270 toSet = CUSTOMIZE_LOGO_PAGE;
272 else if (pPageIndex == DisplayPageIndex::OperatingStatus) {
273 toSet = OPERATING_STATUS_PAGE;
275 else if (pPageIndex == DisplayPageIndex::WmsStatus) {
276 toSet = WMS_STATUS_PAGE;
278 else if (pPageIndex == DisplayPageIndex::EthUsbConnectStatus) {
279 toSet = ETH_USB_CONNECT_STATUS_PAGE;
281 else if (pPageIndex == DisplayPageIndex::NetworkInfo) {
282 toSet = NETWORK_INFORMATION_PAGE;
284 else if (pPageIndex == DisplayPageIndex::BluethootConnection) {
285 toSet = BLUETHOOT_CONNECTION_PAGE;
301 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
317 PAGE_DIRECTION actual = ((
NavigationSensor*)_sensor)->GetDisplayPageDirection();
318 if (actual == NORMAL) {
319 return PageDirection::Normal;
321 else if (actual == UPSIDE_DOWN) {
322 return PageDirection::UpsideDown;
336 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
353 PAGE_DIRECTION toSet = -1;
354 if (pPageDirection == PageDirection::Normal) {
357 else if (pPageDirection == PageDirection::UpsideDown) {
374 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
391 if (actual == NORMAL_MODE) {
392 return DisplayMode::Normal;
394 else if (actual == ON_MODE) {
395 return DisplayMode::On;
397 else if (actual == OFF_MODE) {
398 return DisplayMode::Off;
412 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
430 DISPLAY_MODE toSet = -1;
431 if (pdisplayMode == DisplayMode::Normal) {
434 else if (pdisplayMode == DisplayMode::On) {
437 else if (pdisplayMode == DisplayMode::Off) {
454 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
470 List<List<UInt16>^>^ toReturn = gcnew List<List<UInt16>^>();
472 vector<LOGO_IMAGE_SEGMENT> sensorImage = ((
NavigationSensor*)_sensor)->GetLogoImage();
474 for (
int segment = 0; segment < IMAGE_SEGMENT_SIZE; segment++) {
475 List<UInt16>^ segmentOfPixelToAdd = gcnew List<UInt16>();
476 for (
int pixel = 0; pixel < PIXELS_PER_SEGMENT; pixel++) {
477 segmentOfPixelToAdd->Add( sensorImage[segment][pixel]);
479 toReturn->Add(segmentOfPixelToAdd);
495 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
513 vector<LOGO_IMAGE_SEGMENT> toFetch;
516 for each (List<UInt16>^ segment
in logoToFetch) {
517 vector<IMAGE_PIXEL> segmentToFetch;
519 for each (UInt16 pixel
in segment) {
520 segmentToFetch.push_back(pixel);
523 toFetch.push_back(segmentToFetch);
538 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
570 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
586 List<unsigned int>^ toReturn = gcnew List<unsigned int>();
588 for (
int i = 0; i < actual.size(); i++) {
590 toReturn->Add(actual[i]);
606 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
640 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
675 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
696 toReturn->Led2 = LedColor::Black;
697 toReturn->Led3 = LedColor::Black;
698 toReturn->Led4 = LedColor::Black;
713 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
732 toReturn->Z1 = toFetch.
GetZ1();
733 toReturn->Z2 = toFetch.
GetZ2();
734 toReturn->Z3 = toFetch.
GetZ3();
735 toReturn->Z4 = toFetch.
GetZ4();
736 toReturn->Z5 = toFetch.
GetZ5();
737 toReturn->Z6 = toFetch.
GetZ6();
752 toThrow->
ErrorCode = gcnew String(e.GetErrorCode().c_str());
Definition WBadAcknowledgmentException.h:3
Definition WBaseCommunication.h:25
PageDirection
Definition WEnums.h:11
DisplayPageIndex
Definition WEnums.h:10
DisplayMode
Definition WEnums.h:12
AngularResolution
Definition WEnums.h:6
Definition WEthernetCommunication.h:5
Helper to encapsulate the the raw data error.
Definition FilterType.h:19
unsigned int GetNumH()
Gets historical spots number at current position.
Definition FilterType.cpp:42
void SetNumS(unsigned int numS)
Sets historical spots number on both sides.
Definition FilterType.cpp:66
void SetNumH(unsigned int numH)
Sets historical spots number at current position.
Definition FilterType.cpp:50
FILTER_MODE GetFilterMode()
Gets the filter mode.
Definition FilterType.cpp:26
unsigned int GetNumS()
Gets historical spots number on both sides.
Definition FilterType.cpp:58
void SetFilterMode(FILTER_MODE filterMode)
Sets the filter mode.
Definition FilterType.cpp:34
Definition NavigationSensor.h:42
Definition WFilterType.h:9
property unsigned int NumH
Definition WFilterType.h:26
Definition WNavigationSensor.h:22
WFilterType GetFilterType()
Definition WNavigationSensor.h:44
~WNavigationSensor()
Definition WNavigationSensor.h:33
WSensorLeds GetSensorLeds() new
Gets the sensor's status led.
Definition WNavigationSensor.h:620
WContaminationStatus GetContaminationStatus() new
Gets the contamination status.
Definition WNavigationSensor.h:727
WSensorLamps GetSensorLamps()
Gets the sensor lamps status.
Definition WNavigationSensor.h:690
WConfigurationResult SetDisplayMode(DisplayMode pdisplayMode)
sets the display mode (Accepted values: Normal, On, Off)
Definition WNavigationSensor.h:428
WNavigationSensor(WBaseCommunication^ pcomm)
Definition WNavigationSensor.h:28
PageDirection GetDisplayPageDirection()
Returns the display page direction.
Definition WNavigationSensor.h:315
WNavigationSensor()
Definition WNavigationSensor.h:24
AngularResolution GetAngularResolution() new
Gets the angular resolution.
Definition WNavigationSensor.h:132
List< List< UInt16 >^> GetLogoImage()
Returns the sensor's logo image.
Definition WNavigationSensor.h:468
DisplayPageIndex GetDisplayPageIndex()
Returns the display page index.
Definition WNavigationSensor.h:218
List< unsigned int > GetWms()
Returns the window monitoring system of each sector (SECTORS_COUNT sectors - 132 -)
Definition WNavigationSensor.h:583
WConfigurationResult SetAngularResolution(AngularResolution pResolution) new
Sets the angle resolution. Can be either AngularResolution::ZeroToZeroPointOneAtFourtyHz,...
Definition WNavigationSensor.h:175
WConfigurationResult SetDisplayPageIndex(DisplayPageIndex pPageIndex)
Sets the display page on the given direction.
Definition WNavigationSensor.h:266
WConfigurationResult ResetLogoImage()
Resets the logo image to its default.
Definition WNavigationSensor.h:554
DisplayMode GetDisplayMode()
Returns the display mode (values are NORMAL_MODE, ON_MODE or OFF_MODE)
Definition WNavigationSensor.h:388
WConfigurationResult SetDisplayPageDirection(PageDirection pPageDirection)
Sets the display page on the given direction (Accepted values: NORMAL or UPDIDE_DOWN)
Definition WNavigationSensor.h:351
WConfigurationResult SetFilterType(WFilterType^ pFilterType)
Definition WNavigationSensor.h:86
void Initialize() new
Initializes the object to connect the sensor.
Definition WNavigationSensor.h:40
WConfigurationResult SetLogoImage(List< List< UInt16 >^>^ logoToFetch)
Sets the sensor's logo image.
Definition WNavigationSensor.h:511
WConfigurationResult SetSensorLeds(WSensorLeds^ pLeds) new
Sets the sensors leds status led (ON or OFF)
Definition WNavigationSensor.h:656
Helper to encapsulate the contamination threshold.
Definition ContaminationStatus.h:12
unsigned int GetZ3()
Gets the Navigation sensor's Z3 contamination state.
Definition ContaminationStatus.cpp:89
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 GetZ4()
Gets the Navigation sensor's Z4 contamination state.
Definition ContaminationStatus.cpp:105
Helper to encapsulate the sensor lamps state.
Definition SensorLamps.h:20
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
void SetStatusLed(bool pStatusLed)
Sets the status led.
Definition SensorLeds.cpp:35
Definition WContaminationStatus.h:4
This class is a wrapper around the unmanaged code RawDataSensor. The goal of this classe is make acce...
Definition WRawDataSensor.h:36
WConfigurationResult toManagedInstance(ConfigurationResult pResult)
Definition WRawDataSensor.h:1405
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
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
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
Definition WSensorException.h:6
property String ErrorCode
Definition WSensorException.h:12
Definition WThreadCreationException.h:6