protected void Initialize() { try { _apiHandle = CanInterfaceDll.Init(); } catch (DllNotFoundException) { _logger.LogError("Failed to initialize motors: NTCAN drivers not installed"); PeripheralState = PeripheralState.DriversNotInstalled; return; } if (_apiHandle.Equals(IntPtr.Zero)) { PeripheralState = PeripheralState.NotConnected; _logger.LogInformation("No physical CAN interface found"); } else { _logger.LogInformation("Starting motor calibration..."); PeripheralState = PeripheralState.Initializing; CanInterfaceDll.StartCalibration(_apiHandle, _calibrationDone); } }
private void CreateCamera() { try { var roi = new RegionOfInterest(XMin, YMin, Width, Height); _cameraPtr = GenieNanoDll.CreateCamera( _options.Value.CameraName, roi, _frameArrived, _cameraConnected, _cameraDisconnected); } catch (DllNotFoundException) { _logger.LogError( "Failed to initialize GenieNanoCamera: The Camera SDK is not installed"); PeripheralState = PeripheralState.Error; return; } if (_cameraPtr.Equals(IntPtr.Zero)) { _logger.LogError( "Failed to initialize GenieNanoCamera: Camera was not found on the network"); PeripheralState = PeripheralState.NotConnected; return; } PeripheralState = PeripheralState.Ready; try { ApplyOptions(); } catch (KickermatException ex) { _logger.LogError(ex.Message); } }
public Camera(string id, string name, PeripheralState state) { Id = id; Name = name; PeripheralState = state; }
protected void CalibrationDone(uint minPos, uint maxPos) { _logger.LogInformation("Motors successfully calibrated"); PeripheralState = PeripheralState.Ready; }
// Device state public PeripheralEventArgs(PeripheralState state) { State = state; }
private void CameraDisconnected(string name) { _logger.LogInformation($"Camera {name} disconnected"); PeripheralState = PeripheralState.NotConnected; }
public PeripheralStateChangedEventArgs(PeripheralState newState) { NewState = newState; }