Path: utzoo!attcan!uunet!snorkelwacker!apple!han From: han@Apple.COM (Byron Han, scapegoat) Newsgroups: comp.sys.mac.programmer Subject: Re: RAM serial driver and event handling Message-ID: <10326@goofy.Apple.COM> Date: 20 Sep 90 22:50:35 GMT References: <1990Sep20.143626.23475@midway.uchicago.edu> Organization: Apple Computer, Inc. Lines: 35 In article <1990Sep20.143626.23475@midway.uchicago.edu> rfl@oddjob.UChicago.EDU () writes: > >> As a further note, when opening the serial driver, it is best to check to see >> if the driver is already open before opening - this prevents one application >> from "stealing" the serial driver from another under MultiFinder. > >How do you mean "steal"? Application A opens the serial driver. User switches to Finder and opens Application B which also opens the serial driver. Data is not shared in a totally nondeterministic manner between the two applications. >If my application checks to see if the driver is >already open, what happens if my application changes the baud rate? Or what >happens if someone clicks to another application in MultiFinder that uses >the port at another baudrate? How does an application handle things like this? Appications B (a A for that matter) should check to see if the serial driver to be opened is already opened or not. If it is already open, it should put up an alert saying that the serial port is already in use. If the driver is not open, _PBOpen should then be called. If _PBOpen returns portInUse, the application should also post an alert. This is what the Serial Connection Tool does. Oh also, do not assume that the only drivers available are .Ain, .Aout, .BIn, and .Bout. If the CommToolbox is installed, perform a lookup of the serial devices that are installed to get the names of all of the ports and the names of the associated input and output drivers (which should all support the same control calls that the existing .A/B In/Out drivers do. Hope this helps. Byron Han Occasional Wizard .