public DolphiimoteDll(string path) { nativeDll = new NativeDll(path); if (Marshal.SizeOf(typeof(DolphiimoteCallbacks)) != 24) { throw new InvalidOperationException("DolphiimoteCallbacks wrong size. Expected: 24, got:" + Marshal.SizeOf(typeof(DolphiimoteCallbacks))); } if (Marshal.SizeOf(typeof(DolphiimoteData)) != 128) { throw new InvalidOperationException("DolphiimoteData wrong size. Expected: 128, got:" + Marshal.SizeOf(typeof(DolphiimoteData))); } if (Marshal.SizeOf(typeof(DolphiimoteCapabilities)) != 16) { throw new InvalidOperationException("DolphiimoteCapabilities wrong size."); } dolphiimoteInit = nativeDll.GetDelegateFromFunction <DolphiimoteInit>("dolphiimote_init"); dolphiimoteUpdate = nativeDll.GetDelegateFromFunction <DolphiimoteUpdate>("dolphiimote_update"); dolphiimoteSetReportingMode = nativeDll.GetDelegateFromFunction <DolphiimoteSetReportingMode>("dolphiimote_set_reporting_mode"); dolphiimoteShutdown = nativeDll.GetDelegateFromFunction <DolphiimoteShutdown>("dolphiimote_shutdown"); dolphiimoteEnableCapabilities = nativeDll.GetDelegateFromFunction <DolphiimoteEnableCapabilities>("dolphiimote_enable_capabilities"); dolphiimoteSetRumble = nativeDll.GetDelegateFromFunction <DolphiimoteSetRumble>("dolphiimote_set_rumble"); dolphiimoteRequestStatus = nativeDll.GetDelegateFromFunction <DolphiimoteRequestStatus>("dolphiimote_request_status"); dolphiimoteSetLedState = nativeDll.GetDelegateFromFunction <DolphiimoteSetLedState>("dolphiimote_set_leds"); }
public DolphiimoteDll(string path) { nativeDll = new NativeDll(path); if (Marshal.SizeOf(typeof(DolphiimoteCallbacks)) != 20) { throw new InvalidOperationException("DolphiimoteCallbacks wrong size."); } if (Marshal.SizeOf(typeof(DolphiimoteData)) != 32) { throw new InvalidOperationException("DolphiimoteData wrong size."); } if (Marshal.SizeOf(typeof(DolphiimoteCapabilities)) != 16) { throw new InvalidOperationException("DolphiimoteCapabilities wrong size."); } dolphiimoteInit = nativeDll.GetDelegateFromFunction <DolphiimoteInit>("dolphiimote_init"); dolphiimoteDetermineCapabilities = nativeDll.GetDelegateFromFunction <DolphiimoteDetermineCapabilities>("dolphiimote_determine_capabilities"); dolphiimoteUpdate = nativeDll.GetDelegateFromFunction <DolphiimoteUpdate>("dolphiimote_update"); dolphiimoteSetReportingMode = nativeDll.GetDelegateFromFunction <DolphiimoteSetReportingMode>("dolphiimote_set_reporting_mode"); dolphiimoteShutdown = nativeDll.GetDelegateFromFunction <DolphiimoteShutdown>("dolphiimote_shutdown"); dolphiimoteEnableCapabilities = nativeDll.GetDelegateFromFunction <DolphiimoteEnableCapabilities>("dolphiimote_enable_capabilities"); }
public TrackIRDll(string path, Action<string> logger = null) { this.logger = logger ?? (str => {}); dll = new NativeDll(path); getSignature = dll.GetDelegateFromFunction<NpGetSignature>(GetSignatureName); getPosition = dll.GetDelegateFromFunction<GetHeadposePosition>(GetDataName); queryVersion = dll.GetDelegateFromFunction<NpQueryVersion>(QueryVersionName); registerWindowHandle = dll.GetDelegateFromFunction<NpRegisterWindowHandle>(RegisterWindowHandleName); unregisterWindowHandle = dll.GetDelegateFromFunction<NpUnregisterWindowHandle>(UnregisterWindowHandleName); registerProgramProfileId = dll.GetDelegateFromFunction<NpRegisterProgramProfileId>(RegisterProgramProfileIdName); requestData = dll.GetDelegateFromFunction<NpRequestData>(RequestDataName); startDataTransmission = dll.GetDelegateFromFunction<NpStartDataTransmission>(StartDataTransmissionName); stopDataTransmission = dll.GetDelegateFromFunction<NpStopDataTransmission>(StopDataTransmissionName); startCursor = dll.GetDelegateFromFunction<NpStartCursor>(StartCursorName); stopCursor = dll.GetDelegateFromFunction<NpStopCursor>(StopCursorName); reCenter = dll.GetDelegateFromFunction<NpReCenter>(ReCenterName); }