LAT Hologramm-Software 2.0
Loading...
Searching...
No Matches
Ophir_Vega.m
Go to the documentation of this file.
1classdef Ophir_Vega < Powermeter
2 %
3
4 properties
5 ophirApp;
6 h_USB;
7 Sensor_SN;
8 Sensor_Type;
9 Sensor_Name;
10 SerialNumbers;
11 end
12
13 methods
14
15 function obj = Ophir_Vega()
16
18 end
20 function connect(obj);
21 %Beschreibung aus Beispielcode des Herstellers übernommen:
22 % Set up/initialise the object
23 % Use the actxserver command to create a link to the COM object
24 % This is where we need the programming guide from the third party
25 % application to get the 'progID' to pass to the actxserver command
26
27 % Try to establish a link to the OphirLMMeasurement object
28 try
29 obj.ophirApp = actxserver('OphirLMMeasurement.CoLMMeasurement');
30 catch
31 fig = uifigure;
32 uialert(fig,'Could not establist a link to OphirLMMeasurement','Error');
33 end
34 % Use some of the methods of the object to modify some settings, do some
35 % initialisation etc
36 % Request the object scans for USB devices:
37 obj.SerialNumbers = obj.ophirApp.ScanUSB;
38 if(isempty(obj.SerialNumbers))
39 fig = uifigure;
40 uialert(fig,'No USB devices seem to be connected. Please check and try again','Error');
41 end
42
43 % Open the first USB device found:
44 obj.h_USB = obj.ophirApp.OpenUSBDevice(obj.SerialNumbers{1});
45 % Query the instrument for information about the sensor connected to the
46 % USB device
47 [obj.Sensor_SN obj.Sensor_Type obj.Sensor_Name ]= obj.ophirApp.GetSensorInfo(obj.h_USB(1),0);
48
49 obj.connected = true;
50 end
51
52 function disconnect(obj);
53 %Beschreibung aus Beispielcode des Herstellers übernommen:
54 obj.ophirApp.StopAllStreams;
55 obj.ophirApp.CloseAll;
56 obj.ophirApp.delete;
57 clear obj.ophirApp;
58
59 obj.connected = false;
60 end
61
62 function power = getPower(obj);
63 %Beschreibung aus Beispielcode des Herstellers übernommen:
64 obj.ophirApp.StartStream(obj.h_USB(1),0);
65 pause(0.3);
66 [Value Timestamp Status]= obj.ophirApp.GetData(obj.h_USB(1),0);
67 obj.ophirApp.StopAllStreams;
68 power = Value(end);
69 end
70
71 end
72end
73
settings_t settings
Definition: settings.c:24