예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public Camera(string id, string name, PeripheralState state)
 {
     Id              = id;
     Name            = name;
     PeripheralState = state;
 }
예제 #4
0
 protected void CalibrationDone(uint minPos, uint maxPos)
 {
     _logger.LogInformation("Motors successfully calibrated");
     PeripheralState = PeripheralState.Ready;
 }
        // Device state

        public PeripheralEventArgs(PeripheralState state)
        {
            State = state;
        }
예제 #6
0
 private void CameraDisconnected(string name)
 {
     _logger.LogInformation($"Camera {name} disconnected");
     PeripheralState = PeripheralState.NotConnected;
 }
 public PeripheralStateChangedEventArgs(PeripheralState newState)
 {
     NewState = newState;
 }