PC から Jetson nano への音声データ送信:ソースコード:RobotSpeakerMsgMsg.cs

//Do not edit! This file was generated by Unity-ROS MessageGeneration.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Unity.Robotics.ROSTCPConnector.MessageGeneration;

namespace RosMessageTypes.CppPubsub
{
    [Serializable]
    public class RobotSpeakerMsgMsg : Message
    {
        public const string k_RosMessageName = "cpp_pubsub/RobotSpeakerMsg";
        public override string RosMessageName => k_RosMessageName;

        public short[] audio_data;
        public int debug_count;

        public RobotSpeakerMsgMsg()
        {
            this.audio_data = new short[0];
            this.debug_count = 0;
        }

        public RobotSpeakerMsgMsg(short[] audio_data, int debug_count)
        {
            this.audio_data = audio_data;
            this.debug_count = debug_count;
        }

        public static RobotSpeakerMsgMsg Deserialize(MessageDeserializer deserializer) => new RobotSpeakerMsgMsg(deserializer);

        private RobotSpeakerMsgMsg(MessageDeserializer deserializer)
        {
            deserializer.Read(out this.audio_data, sizeof(short), deserializer.ReadLength());
            deserializer.Read(out this.debug_count);
        }

        public override void SerializeTo(MessageSerializer serializer)
        {
            serializer.WriteLength(this.audio_data);
            serializer.Write(this.audio_data);
            serializer.Write(this.debug_count);
        }

        public override string ToString()
        {
            return "RobotSpeakerMsgMsg: " +
            "\naudio_data: " + System.String.Join(", ", audio_data.ToList()) +
            "\ndebug_count: " + debug_count.ToString();
        }

#if UNITY_EDITOR
        [UnityEditor.InitializeOnLoadMethod]
#else
        [UnityEngine.RuntimeInitializeOnLoadMethod]
#endif
        public static void Register()
        {
            MessageRegistry.Register(k_RosMessageName, Deserialize);
        }
    }
}