Пример #1
0
        public async Task DiscoverDevices()
        {
            string response = String.Empty;

            DatagramSocket socket = new DatagramSocket();
            socket.MessageReceived += Socket_MessageReceived;

            using (var stream = await socket.GetOutputStreamAsync(new HostName("255.255.255.255"), OSCClient.PORT))
            using (var writer = new DataWriter(stream))
            {
                OSCMessage msg = new OSCMessage("/info");
                writer.WriteBytes(msg.BinaryData);
                await writer.StoreAsync();
            }
        }
Пример #2
0
        public static OSCMessage Unpack(byte[] bytes, ref int start)
        {
            string address = UnpackString(bytes, ref start);
            OSCMessage msg = new OSCMessage(address);

            char[] tags = UnpackString(bytes, ref start).ToCharArray();
            foreach (char tag in tags)
            {
                if (tag == ',')
                    continue;

                switch (tag)
                {
                    case ',':
                        continue;
                    case INTEGER:
                        msg.Append(UnpackInt(bytes, ref start));
                        break;
                    case LONG:
                        msg.Append(UnpackLong(bytes, ref start));
                        break;
                    case DOUBLE:
                        msg.Append(UnpackDouble(bytes, ref start));
                        break;
                    case FLOAT:
                        msg.Append(UnpackFloat(bytes, ref start));
                        break;
                    case STRING:
                        msg.Append(UnpackString(bytes, ref start));
                        break;
                    case CHAR:
                        msg.Append(UnpackChar(bytes, ref start));
                        break;
                    case BLOB:
                        msg.Append(UnpackBlob(bytes, ref start));
                        break;
                }
            }
            return msg;
        }