Example #1
0
 public bool SetAvrInitCoefs()
 {
     if (audysseyMultEQAvrTcpClientWithTimeout != null)
     {
         bool   CheckSumChecked = false;
         string CmdString       = "INIT_COEFS";
         Console.WriteLine(CmdString);
         // transmit request
         audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(CmdString, "");
         // response may take some processing time for the receiver
         var    TimeElapsed = Stopwatch.StartNew();
         string AvrString;
         do
         {   // receive reseponse
             audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
             Console.Write(CmdString);
             Console.WriteLine(AvrString);
         } while ((TimeElapsed.ElapsedMilliseconds < 10000) && AvrString.Equals(INPROGRESS));
         return(CmdString.Equals("INIT_COEFS") && AvrString.Equals(ACK) && CheckSumChecked);
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 public bool SetAvrSetCoefDt()
 {
     if (audysseyMultEQAvrTcpClientWithTimeout != null)
     {
         // data for each speaker... this is a very dumb binary data pump... payload must be SECRET!
         foreach (Int32[] Coef in _audysseyMultEQAvr.CoefData)
         {
             // transmit packets in chunks of 512 bytes
             int total_byte_packets = (Coef.Length * 4) / 512;
             // the last packet may have less than 512 bytes
             int last_packet_length = Coef.Length - (total_byte_packets * 128);
             // count for all packets
             if (last_packet_length > 0)
             {
                 total_byte_packets++;
             }
             // transmit all the packets
             for (int current_packet = 0; current_packet < total_byte_packets; current_packet++)
             {
                 Int32[] CopyData = current_packet < total_byte_packets - 1 ? new int[128] : new int[last_packet_length];
                 Array.Copy(Coef, current_packet * 128, CopyData, 0, current_packet < total_byte_packets - 1 ? 128 : last_packet_length);
                 bool   CheckSumChecked = false;
                 string CmdString       = "SET_COEFDT";
                 Console.Write(CmdString);
                 Console.WriteLine(Coef.ToString());
                 // transmit request
                 audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(CmdString, audysseyMultEQAvrTcpClientWithTimeout.Int32ToByte(CopyData), current_packet, total_byte_packets - 1);;
                 string AvrString;
                 // receive rseponse
                 audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
                 Console.Write(CmdString);
                 Console.WriteLine(AvrString);
                 // success if all succeed
                 if (false == (CmdString.Equals("SET_COEFDT") && AvrString.Equals(ACK) && CheckSumChecked))
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
 public bool EnterAudysseyMode()
 {
     if (audysseyMultEQAvrTcpClientWithTimeout != null)
     {
         bool   CheckSumChecked = false;
         string CmdString       = "ENTER_AUDY";
         Console.WriteLine(CmdString);
         // transmit request
         audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(CmdString, "");
         // receive rseponse
         string AvrString;
         audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
         Console.Write(CmdString);
         Console.WriteLine(AvrString);
         return(CmdString.Equals("ENTER_AUDY") && AvrString.Equals(ACK) && CheckSumChecked);
     }
     else
     {
         return(false);
     }
 }
Example #4
0
 public bool SetAudysseyFinishedFlag()
 {
     if (audysseyMultEQAvrTcpClientWithTimeout != null)
     {
         bool   CheckSumChecked = false;
         string CmdString       = "SET_SETDAT";
         Console.WriteLine(CmdString);
         // transmit request
         audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(CmdString, AUDYFINFLG);
         // receive rseponse
         string AvrString;
         audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
         Console.Write(CmdString);
         Console.WriteLine(AvrString);
         return(CmdString.Equals("SET_SETDAT") && AvrString.Equals(ACK) && CheckSumChecked);
     }
     else
     {
         return(false);
     }
 }
    public bool ExitAudysseyMode()
    {
        if (audysseyMultEQAvrTcpClientWithTimeout != null)
        {
            var CheckSumChecked = false;
            var CmdString       = "EXIT_AUDMD";
            Console.WriteLine(CmdString);
            // transmit request
            audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(CmdString, "");
            // receive rseponse
            string AvrString;
            audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
            Console.Write(CmdString);
            Console.WriteLine(AvrString);
            if (!(CmdString.Equals("EXIT_AUDMD") && AvrString.Equals(ACK) && CheckSumChecked))
            {
                return(false);
            }
            // transmit request
            var Data = new byte[] { 0x1b };
            audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(Data);
            // receive rseponse
            audysseyMultEQAvrTcpClientWithTimeout.ReceiveTcpAvrStream(ref CmdString, out AvrString, out CheckSumChecked);
            Console.Write(CmdString);
            Console.WriteLine(AvrString);
            if (!(CmdString.Equals("EXIT_AUDMD") && AvrString.Equals(NACK) && CheckSumChecked))
            {
                return(false);
            }

            Data[0] = 0x04;
            audysseyMultEQAvrTcpClientWithTimeout.TransmitTcpAvrStream(Data);
            return(true);
        }
        else
        {
            return(false);
        }
    }