Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
Notes direct serial communications to Palm devices (continued)

Deciphering a Modem file
Once you have the link set up, you'll have to know what Notes will send and expect back, and for that you need to look into the modem file. The interesting parts of the Null Modem file (located at notes/data/modem/null.mdm) are shown below (the ^M and ^J entries are carriage return and line feed respectively).

[commands]
ESCAPE=+++
ANSWER=CONNECT
AUTO PULSE DIAL=^M^JRING^M^JRING^M^J
AUTO TONE DIAL=^M^JRING^M^JRING^M^J

[responses]
RING=RING
CONNECT=CONNECT
CONNECT=66
CONNECT=+++66

Notes always assumes it's talking to a modem, so first it will send the ESCAPE string "+++" followed by the TONE DIAL string. In return it will expect the device at the other end to send back any of the text strings in the [responses] list. When Notes receives this, it will send the ANSWER message and establish the link. Finally, when Notes hangs up, it will send the ESCAPE string again. With a programmable device at the other end, you can work with the Null Modem file as it is, the advantage being you can reasonably expect it to be there on a client. However, if you need to, there is nothing to stop you from creating your own variations of this file to send and expect different things.

The NetLink API call
Controlling the Notes Serial driver with Lotus Script uses the NetLink API function. Like many functions in the API, its description in the documentation doesn't really do it justice:

...Currently supported only over COM ports. It is intended for character mode connections to foreign systems, such as data retrieval systems.

Look in the Script Library in the example database for the Lotus Script declarations but, basically, it works like this:

  • Call NetLink() with either a COM port/phone number pair or a Connection name and the function establishes the link using the COM port setting and the modem file. If you use the second option you'll need a connection document;

  • Call NetSetSessionMode() to set Stream Mode (before you do anything else!);

  • Call NetReceive() or NetSend() to send/receive data from remote system;

  • Call NetCloseSession() to "hang-up" the connection;

  • Call OSLoadString to turn any error codes into a descriptive string.

The hardest part is establishing the connection. After that, it's plain sailing.

Testing the connection
To test the connection I used a simple LotusScript agent with the phone number string in the NetLink set to "?" as shown below.

Sub Initialize
Dim linkID As Long
Dim nErr As Integer
Dim buffer As String
Dim retSize As Integer

nErr=NetLink(Chr(0),"Com1","?",Chr(0),linkId) 'Initiate a link to Com1
If nErr = 0 Then
buffer="Hello from Notes"+Chr(10)+Chr(0)
nErr=NetSetSessionMode(linkId,NETOPT_STREAM_MODE, SEND_TimeOut,RECV_TimeOut,NETBUFFERS,BUFFSIZE)
nErr=NetSend(linkid,buffer,Len(buffer),NETOPT_SEND_NOW) 'Send message. No buffering
NetCloseSession(LinkId) 'Close the link
Else 'Connection Error
buffer=Ustring(1024,0)
nErr= nErr And ERR_MASK
retSize=OSLoadString(0,nErr,buffer,1024)
Messagebox Left$(buffer,retSize),0, "NetLink Error"
End If
End Sub




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.

Learn more about HELP Software products
-- Advertisement --

DEPARTMENT CALENDAR - MANAGE AND SHARE A COMMON CALENDAR WITH YOUR TEAMS
Are you responsible for improving your organization's Group Calendaring tool? Have you been tasked to find a true group calendar tool with Itinerary, Time-Off, Sign In/Out and Bulletins/Events module that seamlessly integrates with Domino calendaring?

If so, Logic Springs Technologies will make answering these questions a whole lot easier!

Learn how by visiting us at www.departmentcalendar.com

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login