Пример #1
0
 /************************************************************/
 static public bool CMDOUT64(int cmd, int par1, int par2, int par3, int par4, byte[] obuf, byte[] ibuf)
 {
     byte[] commandPacket = new byte[64];
     commandPacket[0] = (byte)cmd;
     commandPacket[1] = (byte)par1;
     commandPacket[2] = (byte)par2;
     commandPacket[3] = (byte)par3;
     commandPacket[4] = (byte)par4;
     if (obuf != null)
     {
         for (int i = 0; i < obuf.Length; i++)
         {
             commandPacket[5 + i] = obuf[i];
         }
     }
     if ((G.AS.DEBUG_MODE & 1) != 0)
     {
         DBGMODE.WRITE_HID(commandPacket);
         if (ibuf != null)
         {
             DBGMODE.READ_HID(ibuf);
         }
         return(true);
     }
     if (WRITE_HID(commandPacket, commandPacket.Length) == 0)
     {
         //	return(false);
     }
     if (ibuf != null)
     {
         if (READ_HID(commandPacket, commandPacket.Length) == 0)
         {
             return(false);
         }
         for (int i = 0; i < commandPacket.Length; i++)
         {
             if (i >= ibuf.Length)
             {
                 break;
             }
             ibuf[i] = commandPacket[i];
         }
     }
     return(true);
 }
Пример #2
0
        /************************************************************/
        static public bool CMDOUT(int cmd, int par1, int par2, int par3, int par4, byte[] buf)
        {
            byte[] commandPacket = new byte[16];
            commandPacket[0] = (byte)cmd;
            commandPacket[1] = (byte)par1;
            commandPacket[2] = (byte)par2;
            commandPacket[3] = (byte)par3;
            commandPacket[4] = (byte)par4;

            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.WRITE_HID(commandPacket);
                if (buf != null)
                {
                    DBGMODE.READ_HID(buf);
                }
                return(true);
            }
            if (WRITE_HID(commandPacket, commandPacket.Length) == 0)
            {
                //			Toast.makeText(TEST24Activity.this, "USB COMMUNICATION ERROR!!!", Toast.LENGTH_SHORT).show();
                //	return(false);
            }
            if (buf != null)
            {
                if (READ_HID(commandPacket, commandPacket.Length) == 0)
                {
                    return(false);
                }
                for (int i = 0; i < commandPacket.Length; i++)
                {
                    if (i >= buf.Length)
                    {
                        break;
                    }
                    buf[i] = commandPacket[i];
                }
            }
            return(true);
        }