/// <summary> /// Asynchronously gets the firmware signature of the party system. /// </summary> /// <returns>The firmware signature</returns> public static async Task <Firmware> GetFirmwareAsync(this ArduinoSession session) { session.RequestFirmware(); //return await Task.Run(() => // (Firmware)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.FirmwareResponse))).Value); return(await Task.Run(() => session.GetMessageFromQueue <Firmware>().Value).ConfigureAwait(false)); }
/// <summary> /// Asynchronously gets the protocol version implemented on the party system. /// </summary> /// <returns>The implemented protocol version</returns> public static async Task <ProtocolVersion> GetProtocolVersionAsync(this ArduinoSession session) { session.RequestProtocolVersion(); //return await Task.Run(() => // (ProtocolVersion)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.ProtocolVersion))).Value); return(await Task.Run(() => session.GetMessageFromQueue <ProtocolVersion>().Value).ConfigureAwait(false)); }
/// <summary> /// Asynchronously gets byte data from the party system, read from the given memory address and register. /// </summary> /// <param name="slaveAddress">The slave's memory address</param> /// <param name="slaveRegister">The slave's register</param> /// <param name="bytesToRead">Number of bytes to read</param> /// <returns>An awaitable <see cref="Task{I2cReply}"/> holding the data read</returns> public static async Task <I2CReply> GetI2CReplyAsync(this ArduinoSession session, int slaveAddress, int slaveRegister, int bytesToRead) { session.ReadI2COnce(slaveAddress, slaveRegister, bytesToRead); //_awaitedMessagesQueue.Enqueue(new FirmataMessage(MessageType.I2CReply)); //return await Task.Run(() => // (I2CReply)((FirmataMessage)GetMessageFromQueue(new FirmataMessage(MessageType.I2CReply))).Value); return(await Task.Run(() => session.GetMessageFromQueue <I2CReply>().Value).ConfigureAwait(false)); }
/// <summary> /// Asynchronously gets a pin's mode (digital input/output, analog etc.) and actual value. /// </summary> /// <param name="pinNumber">The pin number</param> /// <returns>The pin's state</returns> public static async Task <PinState> GetPinStateAsync(this ArduinoSession session, int pinNumber) { session.RequestPinState(pinNumber); //return await Task.Run //( // () => // (PinState)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.PinStateResponse))).Value //); return(await Task.Run(() => session.GetMessageFromQueue <PinState>().Value).ConfigureAwait(false)); }
public static async Task <byte[]> EEPROM_GetAsync(this ArduinoSession session, int index, int length) { Request_EEPROM_Get(session, index, length); return(await Task.Run(() => session.GetMessageFromQueue <byte[]>(EEPROM_DATA, EEPROM_GET).Value.Value).ConfigureAwait(false)); }
public static byte[] EEPROM_Get(this ArduinoSession session, int index, int length) { Request_EEPROM_Get(session, index, length); return(session.GetMessageFromQueue <byte[]>(EEPROM_DATA, EEPROM_GET).Value.Value); }
public static async Task EEPROM_PutAsync(this ArduinoSession session, int index, byte[] bytes) { Request_EEPROM_Put(session, index, bytes); await Task.Run(() => session.GetMessageFromQueue(EEPROM_DATA, EEPROM_PUT)).ConfigureAwait(false); }
public static void EEPROM_Put(this ArduinoSession session, int index, byte[] bytes) { Request_EEPROM_Put(session, index, bytes); session.GetMessageFromQueue(EEPROM_DATA, EEPROM_PUT); }
public static void EEPROM_Write(this ArduinoSession session, int index, byte value) { Request_EEPROM_Write(session, index, value); session.GetMessageFromQueue(EEPROM_DATA, EEPROM_WRITE); }
public static byte EEPROM_Read(this ArduinoSession session, int index) { Request_EEPROM_Read(session, index); return(session.GetMessageFromQueue <byte>(EEPROM_DATA, EEPROM_READ).Value.Value); }
/// <summary> /// Gets a pin's mode (digital input/output, analog etc.) and actual value. /// </summary> /// <param name="pinNumber">The pin number</param> /// <returns>The pin's state</returns> public static PinState GetPinState(this ArduinoSession session, int pinNumber) { session.RequestPinState(pinNumber); //return (PinState)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.PinStateResponse))).Value; return(session.GetMessageFromQueue <PinState>().Value); }
/// <summary> /// Gets the channel-to-pin mappings of the party system's analog lines. /// </summary> /// <returns>The channel-to-pin mappings</returns> public static BoardAnalogMapping GetBoardAnalogMapping(this ArduinoSession session) { session.RequestBoardAnalogMapping(); //return (BoardAnalogMapping)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.AnalogMappingResponse))).Value; return(session.GetMessageFromQueue <BoardAnalogMapping>().Value); }
/// <summary> /// Gets a summary of the party system's capabilities. /// </summary> /// <returns>The system's capabilities</returns> public static BoardCapability GetBoardCapability(this ArduinoSession session) { session.RequestBoardCapability(); //return (BoardCapability)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.CapabilityResponse))).Value; return(session.GetMessageFromQueue <BoardCapability>().Value); }
/// <summary> /// Gets the firmware signature of the party system. /// </summary> /// <returns>The firmware signature</returns> public static Firmware GetFirmware(this ArduinoSession session) { session.RequestFirmware(); //return (Firmware)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.FirmwareResponse))).Value; return(session.GetMessageFromQueue <Firmware>().Value); }
public static int EEPROM_Length(this ArduinoSession session) { Request_EEPROM_Length(session); return(session.GetMessageFromQueue <int>(EEPROM_DATA, EEPROM_LENGTH).Value.Value); }
public static async Task <int> EEPROM_LengthAsync(this ArduinoSession session) { Request_EEPROM_Length(session); return(await Task.Run(() => session.GetMessageFromQueue <int>(EEPROM_DATA, EEPROM_LENGTH).Value.Value).ConfigureAwait(false)); }
public static StepperPosition StepperReportPosition(this ArduinoSession session, int deviceNumber) { session.RequestReportPosition(deviceNumber); return(session.GetMessageFromQueue <StepperPosition>().Value); }
public static async Task <byte> EEPROM_ReadAsync(this ArduinoSession session, int index) { Request_EEPROM_Read(session, index); return(await Task.Run(() => session.GetMessageFromQueue <byte>(EEPROM_DATA, EEPROM_READ).Value.Value).ConfigureAwait(false)); }
/// <summary> /// Asynchronously gets the firmware signature of the party system. /// </summary> /// <returns>The firmware signature</returns> public static async Task <StepperPosition> StepperReportPositionAsync(this ArduinoSession session, int deviceNumber) { session.RequestReportPosition(deviceNumber); return(await Task.Run(() => session.GetMessageFromQueue <StepperPosition>().Value).ConfigureAwait(false)); }
public static async Task EEPROM_UpdateAsync(this ArduinoSession session, int index, byte value) { Request_EEPROM_Update(session, index, value); await Task.Run(() => session.GetMessageFromQueue(EEPROM_DATA, EEPROM_UPDATE)).ConfigureAwait(false); }
/// <summary> /// Gets the protocol version implemented on the party system. /// </summary> /// <returns>The implemented protocol version</returns> public static ProtocolVersion GetProtocolVersion(this ArduinoSession session) { session.RequestProtocolVersion(); //return (ProtocolVersion)((FirmataMessage)session.GetMessageFromQueue(new FirmataMessage(MessageType.ProtocolVersion))).Value; return(session.GetMessageFromQueue <ProtocolVersion>().Value); }