private void sendCommand(int control) {
        synchronized (this) {
            if (control != COMMAND_STATUS) {
                Log.d(TAG, "sendMove " + control);
            }
            //if (mConnection != null) {
            if ((mConnection != null) && (control == COMMAND_FIRE)) {
             if( ButtonStatus = true) {
              ButtonStatus = false;
             } else if
              (ButtonStatus = false) {
               ButtonStatus = true;
             }
           
                //kim byte[] message = new byte[1];
                //kim message[0] = (byte)control;
                /*
                // Write coomand
             byte[] message = new byte[4];
                if(mCommand == 0)
                 mCommand = 1;
                else
                 mCommand = 0;
                message[0] = 41;
                message[1] = 1;
                message[2] = mCommand;
                message[3] = 0;
                */
             
             // Read command
             byte[] message = new byte[2];
                message[0] = 40;
                message[1] = 1;
               
                // Send command via a control request on endpoint zero
                //mConnection.controlTransfer(0x21, 0x9, 0x200, 0, message, message.length, 0);
                mConnection.bulkTransfer(mEndpointIntr, message, message.length, 0);
                //Log.d(TAG, "merong");
           
        }
        }
    }

 

 

 

 

안드로이드 샘플프로젝트에 있는 usb 코드중의 일부입니다.

sendCommand메서드를 같은 클래스 안에서 재호출하고 싶을때는 어떻게 해야하나요?

 

@Override
    public void run() {
        ByteBuffer buffer = ByteBuffer.allocate(2);
        UsbRequest request = new UsbRequest();
        request.initialize(mConnection, mEndpointIntr2);
        byte status = -1;      
        while(true)
         {if(ButtonStatus=true)
         {

                     <-------------------------------------이부분에 sendCommand 메서드를 재호출하고 싶습니다.
          
         
            {request.queue(buffer, 2);
            if (mConnection.requestWait() == request) {
           
                byte newStatus1 = buffer.get(0);
                Log.d(TAG, "buf0->" + newStatus1);
               
                m_Display_string1 = Byte.toString(newStatus1);
                mDisplay.post(m_display_run);
               
                /*m_Display_string = Byte.toString(newStatus);
                mDisplay.post(m_disp