//--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // r e a d R e s p o n s e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Read response from target.                                         //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static String readResponse(
            PJLCommands.eCmdIndex cmdIndx,
            String binTgtFilenamePJLFS)
        {
            PJLCommands.eRequestType reqType = PJLCommands.getType(cmdIndx);

            if ((reqType == PJLCommands.eRequestType.FSDirList) ||
                (reqType == PJLCommands.eRequestType.FSQuery))
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem query; request types:                       //
                //  -   FSDIRLIST                                             //
                //  -   FSQUERY                                               //
                // Response from printer expected.                            //
                //                                                            //
                //------------------------------------------------------------//

                return(readResponseQuery());
            }
            else if (reqType == PJLCommands.eRequestType.FSUpload)
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem upload; request types:                      //
                //  -   FSUPLOAD                                              //
                //                                                            //
                //------------------------------------------------------------//

                return(readResponseUpload(binTgtFilenamePJLFS));
            }
            else
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem action; request types:                      //
                //  -   FSAPPEND                                              //
                //  -   FSDELETE                                              //
                //  -   FSDOWNLOAD                                            //
                //  -   FSINIT                                                //
                //  -   FSMDKIR                                               //
                // Response from printer not expected.                        //
                //                                                            //
                //------------------------------------------------------------//

                return("No response is expected from the " +
                       PJLCommands.getName(cmdIndx) +
                       " action command");
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // s e n d R e q u e s t                                              //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Send previously generated request data to target.                  //
        //                                                                    //
        //--------------------------------------------------------------------//

        public static void sendRequest(PJLCommands.eCmdIndex cmdIndx)
        {
            PJLCommands.eRequestType reqType =
                PJLCommands.getType(cmdIndx);

            if ((reqType == PJLCommands.eRequestType.FSDirList) ||
                (reqType == PJLCommands.eRequestType.FSQuery))
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem query; request types:                       //
                //  -   FSDIRLIST                                             //
                //  -   FSQUERY                                               //
                // Response from printer expected.                            //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(true);
            }
            else if (reqType == PJLCommands.eRequestType.FSUpload)
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem upload to host workstation; request types:  //
                //  -   FSUPLOAD                                              //
                // Response from printer expected - write this direct to the  //
                // target file (it could be (much) larger than standard reply //
                // buffer.                                                    //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(true);
            }
            else
            {
                //------------------------------------------------------------//
                //                                                            //
                // PJL FileSystem action; request types:                      //
                //  -   FSAPPEND                                              //
                //  -   FSDELETE                                              //
                //  -   FSDOWNLOAD                                            //
                //  -   FSINIT                                                //
                //  -   FSMDKIR                                               //
                // Response from printer not expected.                        //
                //                                                            //
                //------------------------------------------------------------//

                TargetCore.requestStreamWrite(false);
            }
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------------//
        //                                              C o n s t r u c t o r //
        // P J L C o m m a n d                                                //
        //                                                                    //
        //--------------------------------------------------------------------//

        public PJLCommand(PJLCommands.eCmdIndex indx,
                          PJLCommands.eCmdFormat format,
                          PJLCommands.eRequestType type,
                          String desc)
        {
            if (indx == PJLCommands.eCmdIndex.Null)
            {
                _cmdName = PJLCommands.nullCmdKey;
            }
            else
            {
                _cmdName = indx.ToString();
            }

            _cmdDesc   = desc;
            _cmdFormat = format;
            _reqType   = type;

            _statsCtParent = 0;
            _statsCtChild  = 0;
        }