public synchronized Message menuRequestTyped ( Message . KnownType requestType , Message . MenuIdentifier targetMenu , CdjStatus . TrackSourceSlot slot , CdjStatus . TrackType trackType , Field ... arguments ) throws IOException { if ( ! menuLock . isHeldByCurrentThread ( ) ) { throw new IllegalStateException ( "renderMenuItems() cannot be called without first successfully calling tryLockingForMenuOperation()" ) ; } Field [ ] combinedArguments = new Field [ arguments . length + 1 ] ; combinedArguments [ 0 ] = buildRMST ( targetMenu , slot , trackType ) ; System . arraycopy ( arguments , 0 , combinedArguments , 1 , arguments . length ) ; final Message response = simpleRequest ( requestType , Message . KnownType . MENU_AVAILABLE , combinedArguments ) ; final NumberField reportedRequestType = ( NumberField ) response . arguments . get ( 0 ) ; if ( reportedRequestType . getValue ( ) != requestType . protocolValue ) { throw new IOException ( "Menu request did not return result for same type as request; sent type: " + requestType . protocolValue + ", received type: " + reportedRequestType . getValue ( ) + ", response: " + response ) ; } return response ; }
Send a request for a menu that we will retrieve items from in subsequent requests when the request must reflect the actual type of track being asked about .