// Text of project Nitro Test written on 22.06.2003 at 22:12 // Beginning of file Main View baseView := {viewBounds: {left: 0, top: 16, right: 208, bottom: 320}, fEndpoint: nil, Mconnect: func () begin if not fEndpoint then begin local options, connectOptions; fEndpoint := { _proto: protoBasicEndpoint, baseView: self }; connectOptions := [ { label: kCMOIrDAConnectInformation, type: 'option, opCode: opSetRequired, data: { arglist: [ 0, 0, StrLen (peerClass.entryLine.text), StrLen (peerClass.entryLine.text), peerClass.entryLine.text, peerClass.entryLine.text, ], typelist: [ 'struct, 'uLong, // my lsap id, default is 0 'uLong, // peer lsap id, default is 0 'uLong, // my name length, default is 1 'uLong, // peer name length, default is 1 ['array, 'char, 0], // my name, default is "X" ['array, 'char, 0], // peer name, default is "X" ], }, } ]; fEndpoint:Instantiate (fEndpoint, fInstantiateOptions); fEndpoint:Bind (nil, nil); SetValue (output, 'text, "Connecting..."); fEndpoint:Connect (connectOptions, { async: true, CompletionScript: func (ep, options, result) ep.baseView:MConnected (ep, options, result) }); /* fEndpoint:Listen (connectOptions, { async: true, reqTimeout: 30000, CompletionScript: func (ep, options, result) ep.baseView:MConnected (ep, options, result) }); */ end end, Mdisconnect: func() begin if fEndpoint then begin try fEndpoint:Cancel (nil) onexception |evt.ex| do nil; try fEndpoint:Disconnect (true, nil) onexception |evt.ex| do nil; try fEndpoint:Unbind (nil) onexception |evt.ex| do nil; try fEndpoint:Dispose () onexception |evt.ex| do nil; SetValue (output, 'text, "Disconnected"); fEndpoint := nil end end, MSend: func() begin if fEndpoint then begin fEndpoint:Output (input.text & unicodeCR & unicodeLF, nil, nil); end end, MReceive: nil, MConnected: func(ep, options, result) begin if result = nil then begin fInput := "Connected"; SetValue (output, 'text, fInput); fEndpoint:SetInputSpec ({ form: 'string, termination: { endSequence: unicodeLF, byteCount: 20 }, InputScript: func (ep, data, term, result) begin ep.baseView:MInputScript (data) end, }); end end, viewQuitScript: // must return the value of inherited:?ViewQuitScript() func() begin :MDisconnect (); inherited:?ViewQuitScript(); end, MInputScript: func (data) begin local i; i := 0; while i < Length (data) do begin write (NumberStr (ExtractByte (data, i)) & " "); i := i + 1; end; write ("\n"); SetValue (output, 'text, data); end, fInstantiateOptions: [ { label: "ircm", type: 'service, opCode: opSetRequired, } ];, fInput: nil, debug: "baseView", _proto: @180 /* protoFloatNGo */ }; input := {viewBounds: {left: 16, top: 8, right: 192, bottom: 98}, viewFormat: 12624, text: "AT", debug: "input", _proto: @185 /* protoInputLine */ }; AddStepForm(baseView, input); StepDeclare(baseView, input, 'input); output := {viewBounds: {left: 17, top: 145, right: 191, bottom: 223}, viewFlags: 1, viewFont: simpleFont10, viewFormat: 337, text: "", debug: "output", viewClass: 81 /* clParagraphView */ }; AddStepForm(baseView, output); StepDeclare(baseView, output, 'output); baseView_v226_0 := { buttonClickScript: func() begin :MSend (); end, text: "Send", viewBounds: {left: 138, top: 108, right: 190, bottom: 124}, _proto: @226 /* protoTextButton */ }; AddStepForm(baseView, baseView_v226_0); baseView_v218_0 := {text: "Response:", viewBounds: {left: 16, top: 128, right: 72, bottom: 144}, _proto: @218 /* protoStaticText */ }; AddStepForm(baseView, baseView_v218_0); baseView_v226_0 := { buttonClickScript: func() begin :MConnect (); end, text: "Connect", viewBounds: {left: 18, top: 274, right: 86, bottom: 290}, _proto: @226 /* protoTextButton */ }; AddStepForm(baseView, baseView_v226_0); baseView_v226_0 := { buttonClickScript: func() begin :MDisconnect (); end, text: "Disconnect", viewBounds: {left: 122, top: 274, right: 190, bottom: 290}, _proto: @226 /* protoTextButton */ }; AddStepForm(baseView, baseView_v226_0); peerClass := {viewBounds: {left: 16, top: 232, right: 192, bottom: 256}, alwaysCallPickActionScript: true, label: "Peer Class:", labelCommands: ["IrDA:IrCOMM", "OBEX", "IrLPT"], text: "IrDA:IrCOMM", debug: "peerClass", _proto: @189 /* protoLabelInputLine */ }; AddStepForm(baseView, peerClass); StepDeclare(baseView, peerClass, 'peerClass); constant |layout_Main View| := baseView; // End of file Main View