コード例 #1
0
ファイル: Servos.cs プロジェクト: zaront/robotarm-samplecode
        /// <summary>
        /// request to receive the current status of all Servos.  the StatusReceived event will fire after this call for each servo
        /// </summary>
        public async Task <ServoStatusResponse[]> GetStatusAsync()
        {
            var result = new ServoStatusResponse[Count];

            return(await _runner.ExecuteAsync(new AsyncCommand <ServoStatusResponse[]>(new ServoStatusCommand(), i =>
            {
                var response = i as ServoStatusResponse;
                if (response != null)
                {
                    //record response for servo
                    result[response.ServoID - 1] = response;

                    //return when all received
                    if (!result.Any(e => e == null))
                    {
                        return result;
                    }
                }
                return null;
            })));
        }
コード例 #2
0
ファイル: Servos.cs プロジェクト: zaront/robotarm-samplecode
 void StatusResponse(ServoStatusResponse status)
 {
     //fire the event for the correct servo
     GetServo(status.ServoID)?.StatusResponse(status);
 }
コード例 #3
0
ファイル: Servo.cs プロジェクト: zaront/robotarm-samplecode
 internal void StatusResponse(ServoStatusResponse status)
 {
     //fire the event
     StatusReceived?.Invoke(_arm, new DataEventArg <ServoStatusResponse>(status));
 }