I'm working on a project where I'm experimenting with building and implementing plugins. I have a structure called "sensor" in the plugin that contains several elements. I would like to be able to return that structure to my main program through the interface, but it doesn't work, and google hasn't been very helpful (probably because I'm searching for the wrong terms). The plugin works fine if I'm passing strings or other variable types, but when I switch from strings to my structure, I get a couple of errors. On my main form where I try to call the function, I get the error 'value of type iMyPlugin.sensor cannot be converted to frmMain.sensor'. In the plugin code, I get the error 'GetSensorReading cannot implement GetSensorReading because there is no matching function on the interface'.
Is what I want to do possible, or is there a better way to do what I want?
This is roughly the code I'm using.
In my main program, I've defined a structure
I call the function in the plugin that returns information like this:
In my plugin interface, I've defined the structure again, plus added the line to to interface with the plugin.
In the code of my plugin, I define sensor again, and also have the code for the GetSensorReading Function
Any help is appreciated.
Is what I want to do possible, or is there a better way to do what I want?
This is roughly the code I'm using.
In my main program, I've defined a structure
VB.NET:
structure Sensor
dim RawReading as string
dim NumericReading as double
end structure
I call the function in the plugin that returns information like this:
VB.NET:
dim tempSensor as sensor
tempsensor = sensorPlugin.GetSensorReading
In my plugin interface, I've defined the structure again, plus added the line to to interface with the plugin.
VB.NET:
public interface iMyPlugIn
structure sensor
dim RawReading as string
dim NumericReading as double
end structure
function GetSensorReading() as sensor
End Interface
In the code of my plugin, I define sensor again, and also have the code for the GetSensorReading Function
VB.NET:
structure sensor
dim RawReading as string
dim NumericReading as double
end structure
public function GetSensorReading() as sensor implements PluginInterFace.IMyPlguin.GetSensorReading
dim temp as sensor
temp.rawreading = "test"
temp.NumericReading = 1.1
return temp
end function
Any help is appreciated.