/// <summary> /// Sends a SysEx message. /// </summary> /// <param name="message"></param> public static void SendSysEx(this ArduinoSession session, byte command, byte[] payload) { if (payload == null || payload.Length == 0) { session.SendSysExCommand(command); return; } var message = new byte[3 + payload.Length]; message[0] = Utility.SysExStart; message[1] = command; Array.Copy(payload, 0, message, 2, payload.Length); message[message.Length - 1] = Utility.SysExEnd; session.Write(message); }
/// <summary> /// Requests the party system to send the channel-to-pin mappings of its analog lines. /// </summary> /// <remarks> /// The party system is expected to return a single SYSEX ANALOG_MAPPING_RESPONSE message. /// This message triggers the <see cref="MessageReceived"/> event. The analog mappings are /// passed in the <see cref="FirmataMessageEventArgs"/> in a <see cref="BoardAnalogMapping"/> object. /// </remarks> internal static void RequestBoardAnalogMapping(this ArduinoSession session) { session.SendSysExCommand(ANALOG_MAPPING_QUERY); }
/// <summary> /// Requests the party system to send a summary of its capabilities. /// </summary> /// <remarks> /// The party system is expected to return a single SYSEX CAPABILITY_RESPONSE message. /// This message triggers the <see cref="MessageReceived"/> event. The capabilities /// are passed in the <see cref="FirmataMessageEventArgs"/> in a <see cref="BoardCapability"/> object. /// </remarks> internal static void RequestBoardCapability(this ArduinoSession session) { session.SendSysExCommand(CAPABILITY_QUERY); }
/// <summary> /// Requests the party system to send a firmware message. /// </summary> /// <remarks> /// The party system is expected to return a single SYSEX REPORT_FIRMWARE message. /// This message triggers the <see cref="MessageReceived"/> event. The firmware signature /// is passed in the <see cref="FirmataMessageEventArgs"/> in a <see cref="Firmware"/> object. /// </remarks> internal static void RequestFirmware(this ArduinoSession session) { //Console.WriteLine($"\r\n{_stopWatch.ElapsedMilliseconds}: RequestFirmware()"); session.SendSysExCommand(REPORT_FIRMWARE); }