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
27 % Try to establish a link to the OphirLMMeasurement
object
29 obj.ophirApp = actxserver('OphirLMMeasurement.CoLMMeasurement');
32 uialert(fig,'Could not establist a link to OphirLMMeasurement','Error');
34 % Use some of the methods of the
object to modify some
settings, do some
36 % Request the
object scans for USB devices:
37 obj.SerialNumbers = obj.ophirApp.ScanUSB;
38 if(isempty(obj.SerialNumbers))
40 uialert(fig,'No USB devices seem to be connected. Please check and try again','Error');
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
47 [obj.Sensor_SN obj.Sensor_Type obj.Sensor_Name ]= obj.ophirApp.GetSensorInfo(obj.h_USB(1),0);
52 function disconnect(obj);
53 %Beschreibung aus Beispielcode des Herstellers übernommen:
54 obj.ophirApp.StopAllStreams;
55 obj.ophirApp.CloseAll;
59 obj.connected =
false;
62 function power = getPower(obj);
63 %Beschreibung aus Beispielcode des Herstellers übernommen:
64 obj.ophirApp.StartStream(obj.h_USB(1),0);
66 [Value Timestamp Status]= obj.ophirApp.GetData(obj.h_USB(1),0);
67 obj.ophirApp.StopAllStreams;