XOn/XOff Software Flow Control Options

One of the Newton 2.x OS Q&As
Copyright © 1997 Newton, Inc. All Rights Reserved. Newton, Newton Technology, Newton Works, the Newton, Inc. logo, the Newton Technology logo, the Light Bulb logo and MessagePad are trademarks of Newton, Inc. and may be registered in the U.S.A. and other countries. Windows is a registered trademark of Microsoft Corp. All other trademarks and company names are the intellectual property of their respective owners.


For the most recent version of the Q&As on the World Wide Web, check the URL: http://www.newton-inc.com/dev/techinfo/qa/qa.htm
If you've copied this file locally, click here to go to the main Newton Q&A page.
This document was exported on 7/23/97.


XOn/XOff Software Flow Control Options (4/3/97)

Q: XOn/XOff software flow control isn't working. What could I be doing wrong?

A: A quirk in the way Unicode characters are packed into 'char fields in the endpoint option is preventing the correct flow control characters from being set in the serial driver. The solution is to use the 'byte symbol rather than the 'char symbol for these fields, thus avoiding the Unicode-to-ASCII conversion that would normally take place. The Newton Programmer's Guide is incorrect; the correct option frames are as follows:

{ label:    kCMOInputFlowControlParms,
  type:     'option,
  opCode:   opSetRequired,
  result:   nil,
  form:     'template,
  data: {
    arglist:  [
      unicodeDC1,           // xonChar  
      unicodeDC3,           // xoffChar 
      true,                 // useSoftFlowControl 
      nil,                  // useHardFlowControl 
      0,                    // not needed; returned 
      0,  ],                // not needed; returned 
    typelist: ['struct,
      'byte,                // XON character
      'byte,                // XOFF character
      'boolean,             // software flow control
      'boolean,             // hardware flow control
      'boolean,             // hardware flow blocked
      'boolean, ],  },  },  // software flow blocked

{ label:    kCMOOutputFlowControlParms,
  type:     'option,
  opCode:   opSetRequired,
  result:   nil,
  form:     'template,
  data: {
    arglist:  [
      unicodeDC1,           // xonChar  
      unicodeDC3,           // xoffChar 
      true,                 // useSoftFlowControl 
      nil,                  // useHardFlowControl 
      0,                    // not needed; returned 
      0,  ],                // not needed; returned 
    typelist: ['struct,
      'byte,                // XON character
      'byte,                // XOFF character
      'boolean,             // software flow control
      'boolean,             // hardware flow control
      'boolean,             // hardware flow blocked
      'boolean, ],  },  },  // software flow blocked