public InSignal(int port, string name, string path, HiCoreClient hiCore) { _hiCore = hiCore; _portNumber = port; _portName = name; _pDll = DllMethods.LoadLibrary(path); }
public double GetSignal() { IntPtr pAddressOfFunctionToCall = DllMethods.GetProcAddress(_pDll, "getInputs"); GetInputs getInputs = (GetInputs)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(GetInputs)); return(getInputs(_portNumber)); }
public void SetSignal(double value) { IntPtr pAddressOfFunctionToCall = DllMethods.GetProcAddress(_pDll, "setInputs"); SetInputs setinputs = (SetInputs)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(SetInputs)); setinputs(_portNumber, value); }
public OutSignal(int port, string name, string path, HiCoreClient hiCore, string channelName) { _hiCore = hiCore; _portNumber = port; _portName = name; _pDll = DllMethods.LoadLibrary(path); _channelName = channelName; }
private void Terminate() { IntPtr pAddressOfFunctionToCall = DllMethods.GetProcAddress(_pDll, "terminate"); terminate Terminate = (terminate)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(terminate)); Terminate(); }
private void Initialze() { IntPtr pAddressOfFunctionToCall = DllMethods.GetProcAddress(_pDll, "initialize"); initialize Initialize = (initialize)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(initialize)); Initialize(); }
public SimulinkModel(string path, HiCoreClient hicore, XmlHelper xmlHelper) { _hiCore = hicore; _pDll = DllMethods.LoadLibrary(path); _path = path; _directoryPath = Path.GetDirectoryName(path); _name = new DirectoryInfo(_directoryPath).Name; Initialze(); ReadXml(); }
public SimulinkModel(string path, HiCoreClient hicore, List <ISignal> inSignals, List <ISignal> outSignals) { _hiCore = hicore; _pDll = DllMethods.LoadLibrary(path); _path = path; _directoryPath = Path.GetDirectoryName(path); _name = new DirectoryInfo(_directoryPath).Name; Initialze(); _inSignals = inSignals; _outSignals = outSignals; }
public void Step() { foreach (var inSignal in _inSignals) { inSignal.Update(); } IntPtr pAddressOfFunctionToCall = DllMethods.GetProcAddress(_pDll, "step"); step Step = (step)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(step)); Step(); foreach (var outSignal in _outSignals) { outSignal.Update(); } }