| Visioscan Set SDK Libraries 1.3.5 Visioscan Set SDK Help documentation file for C++ and C++/CLI |

Loading...
Searching...
No Matches
WUsbCommunication.h
1#pragma once
2#include "WUsbSettings.h"
3#include "UsbCommunication.h"
4#include "WUsbInformation.h"
5 using namespace System::Collections::Generic;
6 namespace WCommunication {
10 public ref class WUsbCommunication : public WBaseCommunication
11 {
12 public:
16 WUsbCommunication() {
17 _communication = new UsbCommunication(AUTO_RECONNECT);
18 }
19
23 ~WUsbCommunication() {
24 delete(_communication);
25 }
26
30 WUsbCommunication(WUsbSettings^ pUsbSettings) : WBaseCommunication() {
31 Settings = pUsbSettings;
32 _communication = new UsbCommunication((UsbSettings*)pUsbSettings->__nativeSettings, AUTO_RECONNECT);
33 }
37 WCommunicationStatus^ Connect() override {
38 CommunicationStatus status = _communication->Connect();
39
40 WCommunicationStatus^ toReturn = gcnew WCommunicationStatus();
41 for (int i = 0; i < status.Channels.size(); i++) {
42 WChannel^ toAdd = gcnew WChannel();
43 toAdd->RawDataAvailability = static_cast<DataAvailabilityEnum>(status.Channels[i].RawDataAvailability);
44 toAdd->Type = static_cast<ChannelTypeEnum>(status.Channels[i].Type);
45
46 toReturn->Channels->Add(toAdd);
47 }
48
49 toReturn->ErrorCode = gcnew WCommunicationErrorCode();
50 toReturn->ErrorCode->ErrorCode = status.ErrorCode.ErrorCode;
51 toReturn->ErrorCode->ErrorMeaning = gcnew String(status.ErrorCode.ErrorMeaning.c_str());
52
53 toReturn->Status = static_cast<ConnectionStatusEnum>(status.Status);
54
55 return toReturn;
56
57 }
61 void Disconnect() override {
62 _communication->Disconnect();
63 }
64
70 static List<WUsbInformation^>^ GetDeviceList() {
71 List<WUsbInformation^>^ toReturn = gcnew List<WUsbInformation^>();
72 WUsbInformation^ toAdd;
73
74 vector<UsbInformation> infos = UsbCommunication::GetDeviceList();
75 for (int i = 0; i < infos.size(); i++) {
76 toAdd = gcnew WUsbInformation();
77 toAdd->BusNumber = infos[i].GetBusNumber();
78 toAdd->DeviceAddress = infos[i].GetDeviceAddress();
79 toAdd->Manufacturer = gcnew String(infos[i].GetManufacturer().c_str());
80 toAdd->ProductDescription = gcnew String(infos[i].GetProductDescription().c_str());
81 toAdd->ProductId = infos[i].GetProductId();
82 toAdd->SerialNumber = gcnew String(infos[i].GetSerialNumber().c_str());
83 toAdd->Speed = gcnew String(infos[i].GetSpeed().c_str());
84 toAdd->VendorId = infos[i].GetVendorId();
85
86 toReturn->Add(toAdd);
87 }
88
89 return toReturn;
90 }
91 protected:
92 };
93}
94
WCommunication
Definition WEthernetCommunication.h:5
CommErrorCode::ErrorMeaning
std::string ErrorMeaning
Definition CommunicationStructures.h:16
CommErrorCode::ErrorCode
int ErrorCode
Definition CommunicationStructures.h:15
CommunicationStatus
Definition CommunicationStructures.h:24
CommunicationStatus::Status
ConnectionState Status
Definition CommunicationStructures.h:26
CommunicationStatus::Channels
vector< Channel > Channels
Definition CommunicationStructures.h:25
CommunicationStatus::ErrorCode
CommErrorCode ErrorCode
Definition CommunicationStructures.h:27
UsbCommunication
This class handles the USB communication.
Definition UsbCommunication.h:45
UsbCommunication::GetDeviceList
static vector< UsbInformation > GetDeviceList()
A static method that retrieve the devices wired to the computer throug USB.
Definition UsbCommunication.cpp:336
UsbSettings
The USB settings encapsulation for USB communication.
Definition UsbSettings.h:18
WUtils::WChannel
Definition WChannel.h:12
WUtils::WChannel::Type
property ChannelTypeEnum Type
Definition WChannel.h:22
WUtils::WCommunicationErrorCode
Definition WCommunicationErrorCode.h:6
WUtils::WCommunicationStatus
Definition WCommunicationStatus.h:16
WUtils::WCommunicationStatus::Channels
property List< WChannel^> Channels
Definition WCommunicationStatus.h:24
WCommunication::WUsbCommunication
A wrapper on the UsbCommunication.
Definition WUsbCommunication.h:11
WCommunication::WUsbCommunication::WUsbCommunication
WUsbCommunication()
Base constructor.
Definition WUsbCommunication.h:16
WCommunication::WUsbCommunication::WUsbCommunication
WUsbCommunication(WUsbSettings^ pUsbSettings)
Copy constructor.
Definition WUsbCommunication.h:30
WCommunication::WUsbCommunication::~WUsbCommunication
~WUsbCommunication()
Destructor.
Definition WUsbCommunication.h:23
WCommunication::WUsbCommunication::Disconnect
void Disconnect() override
Disconnect from the USB device.
Definition WUsbCommunication.h:61
WCommunication::WUsbCommunication::Connect
WCommunicationStatus Connect() override
Connects to the USB Device.
Definition WUsbCommunication.h:37
WCommunication::WUsbCommunication::GetDeviceList
static List< WUsbInformation^> GetDeviceList()
A static method that retrieve the devices wired to the computer throug USB.
Definition WUsbCommunication.h:70
WCommunication::WUsbInformation
A wrapper on the USB Information.
Definition WUsbInformation.h:13
WCommunication::WUsbInformation::BusNumber
property unsigned int BusNumber
Definition WUsbInformation.h:29
WCommunication::WUsbSettings
A wrapper on the UsbSettings.
Definition WUsbSettings.h:16