Exemple #1
0
        public int FilePlayStart(Device d, string s_ip, int s_port, string stype, int vol, string param)
        {
            int result = 0;

            CommandStart cs = new CommandStart();

            cs.command        = "start";
            cs.streamtype     = stype;
            cs.mode           = "recvonly";
            cs.protocol       = "tcp";
            cs.volume         = vol;
            cs.param          = param;
            cs.dataserver     = s_ip;
            cs.dataserverport = s_port;

            string jsontext = JsonConvert.SerializeObject(cs);
            string ack      = null;

            lock (d)
            {
                ack = SendCommand(d, "start", jsontext);
            }

            if (ack != null)
            {
                CommandStartAck csa = JsonConvert.DeserializeObject <CommandStartAck>(ack);
                if (csa.result == 100)
                {
                    result = 0;
                }
                else
                {
                    result = -2;
                }
            }
            else
            {
                result = -1;
            }
            return(result);
        }
Exemple #2
0
        public int IntercomStart(Device d, string s_ip, int s_port, string streamtype, string protocol, int volume, int gain, string source, string aec)
        {
            if (d == null)
            {
                return(-1);
            }
            int          m   = 0;
            CommandStart cs2 = new CommandStart();

            cs2.command        = "start";
            cs2.streamtype     = streamtype;
            cs2.dataserver     = s_ip;
            cs2.dataserverport = s_port;
            cs2.mode           = "recvsend";
            cs2.volume         = volume;
            cs2.samplerate     = 8000;
            cs2.inputgain      = gain;
            cs2.inputsource    = source;
            cs2.protocol       = protocol;
            cs2.buffer         = "disable";
            cs2.aecmode        = aec;
            cs2.param          = d.id.ToString();
            string jsontext = JsonConvert.SerializeObject(cs2);
            string ack;

            lock (d)
            {
                ack = SendCommand(d, "start", jsontext);
            }
            if (ack != null)
            {
                CommandStartAck cs = JsonConvert.DeserializeObject <CommandStartAck>(ack);
                if ((cs.result == 100) || (cs.result == 200))
                {
                    return(0);
                }
            }
            return(-1);
        }
Exemple #3
0
        public int  FirmwareUpdate(Device d, string s_ip, int s_port, string fname, string mode)
        {
            int result = 0;
            CommandFirmwareUpdate cs = new CommandFirmwareUpdate();

            cs.command        = "update";
            cs.mode           = mode;
            cs.dataserver     = s_ip;
            cs.dataserverport = s_port;

            string jsontext = JsonConvert.SerializeObject(cs);
            string ack      = null;

            lock (d)
            {
                ack = SendCommand(d, "update", jsontext);
            }

            if (ack != null)
            {
                CommandStartAck csa = JsonConvert.DeserializeObject <CommandStartAck>(ack);
                if (csa.result == 100)
                {
                    result = 0;
                }
                else
                {
                    result = -2;
                }
            }
            else
            {
                result = -1;
            }
            return(result);
        }