Newton Docking Protocol |
|
Navigation» About » GitHub Mottek Blog» Mottek » Archive 2022 2020 2019 2018 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 Search |
OverviewThe Connection protocol is used to communicate between the desktop and the Newton. Newton communicates with the desktop by exchanging newton event commands. The general command structure looks like this:
In the commands below, all data is padded with nulls to 4 byte boundaries. The length associated with each command is the length (in bytes) of the data following the length field. All strings are C strings unless otherwise specified. Remote queryAll of the commands in this section are based on the NewtonScript query functions. Please see the Newton Programmer’s Guide for details about the functions performed by the commands. The query command returns a long representing the queries cursor. Each of the other commands take this cursor as a parameter. Entries are returned with the kDEntry command. Newton -> Desktop Commands
Desktop -> Newton
Newton -> Desktop Detailed Commands
Newton returns a long value. The interpretation of the data depends on the command which prompted the return of the long value. Desktop-> Newton Detailed Commands
The parameter frame must contain a queryspec slot and may contain a soupname slot. Performs the specified query on the current store. The query spec is a full query spec including valid test, etc. functions. Soup name is a string that’s used to find a soup in the current store to query. If the soup name is an empty string or a NILREF the query is done on the current soup. A kDLongData is returned with a cursor ID that should be used with the rest of the remote query commands.
The entry at the specified key location is returned. Nil is returned if there is no entry with the specified key.
Returns the entry at the current cursor.
Applies the specified function to each of the cursor’s entries in turn and returns an array of the results. A kDRefResult is returned. See MapCursor in NPG.
Moves the cursor forward count entries from its current position and returns that entry. Returns nil if the cursor is moved past the last entry.
Moves the cursor to the next entry in the set of entries referenced by the cursor and returns the entry. Returns nil if the cursor is moved past the last entry.
Moves the cursor to the previous entry in te set of entries referenced by the cursor and returns the entry. If the cursor is moved before the first entry nil is returned..
Resets the cursor to its initial state. A kDRes of 0 is returned.
Resets the cursor to the rightmost entry in the valid subset. A kDRes of 0 is returned.
Returns the count of the entries matching the query specification. A kDLongData is returned.
Returns kDLongData with a 0 for unknown, 1 for start and 2 for end.
Disposes the cursor and returns a kDRes with a 0 or error. Keyboard PassthroughDesktop -> Newton
Dekktop -> Newton or Newton -> Desktop
Desktop initiated keyboard passthrough would look like this: Desktop Newton
Newton initiated keyboard passthrough would look like this: Desktop Newton
Desktop-> Newton Detailed Commands
This command sends 1 character to the Newton for processing. The char is a 2 byte unicode character + a 2 byte state. The state is defined as follows:
This command sends a string of characters to the newton for processing. The characters are 2 byte unicode characters. If there are an odd number of characters the command should be padded, as usual. Dekktop -> Newton or Newton -> Desktop Detailed Commands
This command is sent to enter keyboard passthrough mode. It can be followed by kDKeyboardChar, kDKeyboardString, kDHello and kDOperationComplete commands. Misc additionsOverviewNewton -> Desktop Commands
Desktop -> Newton
Desktop -> Newton or Newton -> Desktop
Newton -> Desktop Detailed Commands
This command returns a store info frame describing the default store. This frame contains the same info returned for all stores by the kDStoreNames command except that it doesn’t include the store info. It contains the name, signature, total size, used size and kind.
This command returns the names of the applications present on the newton. It also, optionally, returns the names of the soups associated with each application. The array looks like this:
Some built-in names are included. “System information” includes the system and directory soups. If there are packages installed, a “Packages” item is listed. If a card is present and has a backup there will be a “Card backup” item. If there are soups that don’t have an associated application (or whose application I can’t figure out) there’s an “Other information” entry. The soup names are optionally returned depending on the value received with kDGetAppNames.
This command is sent after the user closes the slip displayed by kDImportParametersSlip. The result is a frame containing the following three slots:
If the user cancels, the result sent is a nil ref.
This command is sent in response to a kDGetPackageInfo command. An array is returned that contains a frame for each package with the specified name (there may be more than one package with the same name but different package id). The returned frame looks like this:
This command is sent in response to a kDBackupSoup command–see that command for command sequence details. The length for this command is always set to -1 indicating that the length is unknown. The ids are specified as a compressed array of 16 bit numbers. Each id should be offset by any value specified by a previous kDSetBaseID command (this is how we can specify a 32 bit value in 15 bits). Each id is a number between 0 and 0x7FFF (32767). Negative numbers specify a count of the number of entries above the previous number before the next break (non-contiguous id). The sequence is ended by a 0x8000 word. So, if the newton contains ids
the array would look like this:
Thus we send 8 words instead of 11 longs. Is it worth it? If there are a lot of entries it should be.
This command sets a new base id for the ids sent with subsequent kDBackupIDs commands. The new base is a long which should be added to every id in all kDBackupIDs commands until a kDBackupSoupDone command is received.
This command terminates the sequence of commands sent in response to a kDBackupSoup command.
This command is sent in response to a kDBackupSoup command if the soup is unchanged from the last backup.
This command is sent to the desktop when the user taps the Synchronize button on the newton.
This command is sent in response to a kDCallGlobalfunction or kDCallRootMethod command. The ref is the return value from the function or method called.
This command controls which VBOs are sent compressed to the desktop. VBO can always be sent compressed, never compressed or only package VBOs sent compressed.
This command is used to restore the patch backed up with kDGetPatches. The newton returns a kDResult of 0 (or an error if appropriate) if the patch wasn’t installed. If the patch was installed the newton restarts. Desktop-> Newton Detailed Commands
This command tells the newton to delete a package. It can be used during selective restore or any other time.
Reports a desktop error to the Newton. The string is included since the Newton doesn’t know how to decode all the desktop errors (especially since the Mac and Windows errors are different). ErrorString is a ref.
Tells the Newton the version that the subsequent data is from. For example, if a 1.x data file is being restored the desktop would tell the Newton that version 1 data was comming. Same for importing a 1.x NTF file. Otherwise, it should indicate that 2.x data is comming. When the connection is first started the version defaults to 2.x. This information is necessary for the Newton to know whether or not it should run the conversion scripts. A kDRes command with value 0 is sent by the Newton in response to this command. This commands affects only data added to the Newton with kDAddEntry and kDAddEntryWithUniqueID commands. In particular, note that data returned by kDReturnEntry isn’t converted if it’s a different version than was set by this command. manufacturer and machinetype tell the Newton the type of newton that’s the source of the data being restored. These are sent at the beginning of a connection as part of the Newtonname command.
This command is sent when the PC wants to add an entry to the current soup. The entry is added with the ID specified in the data frame. If the id already exists an error is returned. Warning! This function should only be used during a restore operation. In other situations there’s no way of knowing whether the entrie’s id is unique. If an entry is added with this command and the entry isn’t unique an error is returned.
The package info for the specified package is returned. See the kDPackageInfo command described below Note that multiple packages could be returned because there may be multiple packages with the same title but different package ids. Note that this finds packages only in the current store.
This command returns info about the default store. This info is the same as the info returned by the kDGetStoreNames command (see kDStoreNames for details). The default store is the one used by LoadPackage.
This command creates a soup on the current store. It uses a registered soupdef to create the soup meaning that the indexes, etc. are determined by the ROM. If no soupdef exists for the specified soup an error is returned. A kDResult is returned.
This command asks the Newton to send information about the applications installed on the Newton. See the kDAppNames description above for details of the information returned. The return what parameter determine swhat information is returned. Here are the choices:
This command installs a protocol extension into the newton. The extension lasts for the length of the current connection (in other words, you have to install the extension every time you connect). The function is a newton script closure that would have to be compiled on the desktop. See the Dante Connection (ROM) API IU document for details. A kDResult with value 0 (or the error value if an error occurred) is sent to the desktop in response.
This command removes a previously installed protocol extension.
This commands sets the signature of the current store to the specified value. A kDResult with value 0 (or the error value if an error occurred) is sent to the desktop in response.
This commands sets the signature of the current soup to the specified value. A kDResult with value 0 (or the error value if an error occurred) is sent to the desktop in response.
The following is a possible example of what would be displayed on the Newton following the kDImportParametersSlip command: The slip will, at minimum, display 2 text string fields corresponding to the slip title and a filename. Up to 5 additional fields, plus the CloseBox, could be displayed. While the slip is displayed, “helos” are sent to the desktop. When the user taps on the “Import” button or the CloseBox, a kDImportParameterSlipResult is sent to the desktop. Each of the other 5 fields is shown if the slot defining it exists in the frame parameter. The frame contains the following slots used to configure the display of the slip:
This command displays the password slip to let the user enter a password. The string is displayed as the title of the slip. A kDPassword command is returned.
This command requests that all of the entries in a soup be returned to the desktop. The newton responds with a series of kDEntry commands for all the entries in the current soup followed by a kDBackupSoupDone command. All of the entries are sent without any request from the desktop (in other words, a series of commands is sent). The process can be interrupted by the desktop by sending a kDOperationCanceled command. The cancel will be detected between entries. The kDEntry commands are sent exactly as if they had been requested by a kDReturnEntry command (they are long padded).
This command is used to backup a soup. The result is a series of commands that includes all entries changed since the last sync time (set by a previous command), all entries with a uniqeu ID greater than the one specified, and the unique ids of all other entries to be used to determine if any entries were deleted. The changed entries are sent with kDEntry commands. The unique ids are sent with a kDBackupIDs command. A kDBackupSoupDone command finishes the sequence. If there are any IDs > 0x7FFF there could also be a kDSetBaseID command. The changed entries and unique ids are sent in unique id sequence. The newton checks for kDOperationCanceled commands occasionally. If the soup hasn’t been changed since the last backup a kDSoupNotDirty command is sent instead of the ids. A typical sequence could look like this:
See the definition of the other commands for details.
This command requests that the name of the current store be set to the specified name.
This command asks the newton to call the specified function and return it’s result. This function must be a global function. The return value from the function is sent to the desktop with a kDCallResult command.
This command asks the newton to call the specified root method. The return value from the method is sent to the desktop with a kDCallResult command. Desktop -> Newton or Newton -> Desktop Detailed Commands
This command is sent when an operation is completed. It’t only sent in situations where there might be some ambiguity. Currently, there are two situations where this is sent. When the desktop finishes a restore it sends this command. When a sync is finished and there are no sync results (conflicts) to send to the newton the desktop sends this command.
This command is sent when the user cancels an operation. Usually no action is required on the receivers part exept to return to the “ready” state.
This command is sent in response to a kDOperationCanceled.
This command is first sent from the desktop to the Newton. The newton immediately echos the object back to the desktop. The object can be any newtonscript object (anything that can be sent through the object read/write). This command can also be sent with no ref attached. If the length is 0 the command is echoed back to the desktop with no ref included.
This command is sent when a message is received that is unknown. When the desktop receives this command it can either install a protocol extension and try again or return an error to the Newton. If the built-in Newton code receives this command it always signals an error. The bad command parameter is the 4 char command that wasn’t recognized. The data is not returned. Starting a session2.0 Newton supports a new set of protocols to enhance the connection capabilities. However, since it’s desirable to also support package downloading from NPI, NTK 1.0 and Connection 2.0 the ROMs will also support the old protocol for downloading packages. To make this work the 2.0 ROMs will pretend that they are talking the old protocol when they send the kDRequestToDock message. If a new connection (or other app) is on the other end the protocol will be negotiated up to the current version. Only package loading is supported with the old protocol. Newton -> Desktop Commands
Desktop -> Newton Commands
Examples When a 2.0 ROM Newton is communicating with a 3.0 Connection the session would start like this:
If the password sent from the Newton is wrong it would look like this instead. The password exchange can occurr up to 3 times before the desktop gives up.
If the password sent from the Desktop is wrong the Newton signals an error immediately.
If the desktop decides that the Newton has had enough guesses a kDResult can be sent instead of a kDPWWrong. A kDBadPassword error should be specified. No matter what the intent of the desktop or the Newton, these commands must always start a session (the desktop can substitute a kDResult for the kDSetTimeout if it doesn’t want to set the timeout). If no password has been specied, the key is returned unencrypted. When a 2.0 ROM Newton is communicating with NPI 1.0, NTK 1.0 or 2.0 Connection the session would look like this:
Newton -> Desktop Detailed Commands
This command returns the key received in the initiateDocking message encrypted using the password.
This command is used to negotiate the real protocol version. See kDDesktopInfo below for more info. The password key is used as part of the password verification.
This command is sent in response to a correct kDInitiateDocking command from the docker. The Newton’s name is used to locate the proper synchronize file. The version info includes things like machine type (e.g. J1), ROM version, etc. Here’s the full list of what the version info includes (all are longs):
The version info is followed by the name of the Newton sent as a Unicode string including the terminating zeros at the end. The string is padded to an even 4 bytes by adding zeros as necessary (the padding bytes are not included in the length sent as part of the command header). Desktop-> Newton Detailed Commands
This command is used to negotiate the real protocol version. The protocol version sent with the kDRequestToDock command is now fixed at version 9 (the version used by the 1.0 ROMs) so we can support package loading with NPI 1.0, Connection 2.0 and NTK 1.0. Connection 3.0 will send this command with the real protocol version it wants to use to talk to the Newton. The Newton will respond with a number equal to or lower than the number sent to it by the desktop. The desktop can then decide whether it can talk the specified protocol or not. The desktop type is a long that identifies the senderÇ0 for the Mac and 1 for Windows. The password key is used as part of the password verification. Session type will be the real session type and should override what was sent in kDInitiateDocking. In fact, it will either be the same as was sent in kDInitiateDocking or “settingUp” to indicate that altho the desktop has accepted a connection, the user has not yet specified an operation. AllowSelectivesync is a boolean. The desktop should say no when the user hasn’t yet done a full sync and, therefore, can’t do a selective sync. desktopApps is an array of frames that describes who the Newton is talking with. Each frame in the array looks like this:
There might be more than one item in the array if the Newton is connecting with a DIL app. The built-in Connection app expects 1 item in the array that has id:
It won’t allow connection with any other id. NCK 2.0, NTK and NPI use old revs of the protocol and aren’t considered here.
This command is used to customize the set of icons shown on the Newton. The iconMask is a long that indicates which icons should be shown. For example, to show all icons you would use this:
Sync and Selective SyncNewton -> Desktop Commands
Desktop -> Newton Commands
Examples After the session is started (see above) these commands would be sent.
The following would appear only if syncing system info:
The following would appear only if syncing packages:
Note that the above only syncs 1.x style packages on locked 1.x cards. To complete the package sync the packages soup should also by synced. The sync would continue like this:
Repeat the above for each store and soup followed by:
Optionally the desktop could send this instead of the operation complete:
Newton -> Desktop Detailed Commands
This command is sent when the Newton wants to start a sync operation.
This command is sent whenever the user on the Newton has selected selective sync. The frame sent completely specifies which information is to be snychrnoized.
Each store frame in the stores array contains the same information returned by the kDStoreNames command with the addition of soup information. It looks like this:
If the user has specified to sync all information the frame will look the same except there won’t be a soups slot–all soups are assumed. Note that the user can specify which stores to sync while specifying that all soups should be synced. If the user specifies that packages should be synced the packages flag will be true and the packages soup will be specified in the store frame(s). Desktop-> Newton Detailed Commands
This command is sent when the desktop wants to get the selective sync or selective restore info from the Newton.
This command can optionally be sent at the end of synchronization. If it is sent, the results are displayed on the Newton. The array looks like this:
Restored is true if the desktop detected that the newton had been restore to since the last sync. Count is the number of conflicting entries that were found for each soup. Soups are only in the list if they had a conflict. When a conflict is detected, the newton version is saved and the desktop version is moved to the archive file.
This command is the same as kDSetCurrentStore except that it returns the names of the soups on the stores as if you’d send a kDGetSoupNames command. It sets the current store on the Newton. A store frame is sent to uniquely identify the store to be set:
A kDSoupNames is sent by the newton in response.
This command is like a combination of kDSetCurrentSoup and kDGetChangedInfo. It sets the current soup–see kDSetCurrentSoup for details. A kDSoupInfo or kDRes command is sent by the newton in response.
This command is like kDGetIndexDescription except that it only returns the index description if it has been changed since the time set by the kDLastSyncTIme command. If the index hasn’t changed a kDRes with 0 is returned.
This command is like kDGetSoupInfo except that it only returns the soup info if it has been changed since the time set by the kDLastSyncTIme command. If the info hasn’t changed a kDRes with 0 is returned. File browsingFile browsing will use the same protocol described above with the following additions. For synchronize, the process is completely driven from the desktop side. For file browsing/importing, however, the process is driven from the Newton. Newton -> Desktop Commands
Desktop -> Newton
Examples After the session has started (see above) these commands would be sent:
Note that we must start the transaction with a requestToDock to force 1.0 and 2.0 versions of Connection to display the correct message. When the user changes the path by tapping on a folder, picking a new level from the path popup, or picking a new drive on the drive popup:
When the user changes the drive by picking a drive on the drive popup (Windows only), the desktop will change the drive and set the directory to the current directory for that drive, and return the new path to the newton:
If the folder is an alias, it’s like this (Mac only):
When the user taps on the File Info button:
If the selected item is an alias (Mac only), before doing import, getfileinfo, or setpath:
If the Windows user picks a new filter from the list:
Newton -> Desktop Detailed Commands All commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command is sent to a desktop that the Newton wishes to browse files on. File types can be ‘import, ‘packages, ‘syncFiles or an array of strings to use for filtering.
This command asks the desktop system to return an array of device names. This is only used for the windows platform.
This commands requests the desktop system to return the default path. This is the list that goes in the folder popup for the Mac and in the directories list for Windows.
This command requests that the desktop system return the files and folders necessary to open a standard file like dialog.
This command tells the desktop that the user has changed the path. The desktop responds with a new list of files and folders. The path is sent as an array of strings rather than an array of frames as all of the other commands are for performance reasons. For the Mac, the array would be something like:
to set the path to “My hard disk:business:”. “Desktop” will always be at the start of the list, since that’s the way Standard File works. So if the user wanted to set the path to somewhere in the Desktop Folder he would send something like
The second item in the array, will always be a frame instead of a string and will contain an additional slot “whichvol” to indicate to the desktop whether that item is a name of a volume or a folder in the Desktop Folder and if so it’s volRefNum. For Windows the array would be something like:
to set the path to “c:\business.”
This command asks the desktop to change the drive on the desktop and set the directory to the current directory for that drive. The string contains the drive letter followed by a colon e.g. “C:”.
This command asks the desktop to return info about the specified file. See kDFileInfo for info about what’s returned. If the selected item is at the Desktop level, a frame {Name:“Business”, whichVol:-1} will be sent instead of the string to indicate the volRefNum for the file.
This command returns information about the internal store. The info is in the form of a frame that looks like this:
This is the same frame returned by kDStoreNames except that the store info isn’t returned.
This command asks the desktop to send a list of filters to display in the windows file browser. A kDFilters command is expected in response.
This command changes the current filter being used. A kDFilesAndFolders command is expected in return. The index is a long indicating which item in the filters array sent from the desktop should be used as the current filter. Index is 0 based. Desktop-> Newton Detailed Commands All commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command returns an array of frames describing devices. These are the devices which will appear in the devices popup in the Windows file browsing dialog. Each frame in the array should look like this:
where (floppy # 0, hardDrive # 1, cdRom # 2, netDrive # 3) The icon is displayed in the popup. This may not be possible in which case this slot will be optional.
This command returns an array of filters to the newton. It’s sent in response to a kDGetFilters command. The filter should be an array of strings which are displayed in the filter popup. If the filter array is nil no popup is displayed.
This command returns the initial strings for the folder popup in the Mac version of the window and for the directories list in the Windows version. It is also returned after the user taps on a folder alias. In this case the path must be changed to reflect the new location. Each element of the array is a frame that takes this form:
The possible values for type are (desktop # 0, file # 1, folder # 2, disk # 3). If the type is disk, there is an additional slot disktype with the values (floppy # 0, hardDrive # 1, cdRom # 2, netDrive # 3). Finally, for the second frame in the array i.e. the one after Desktop, there will be an additional slot whichvol, which will be a 0 if the item is disk or a volRefNum if the item is a folder on the desktop. For example, the Mac might send:
or for some folder on the desktop it it might send:
for Windows it might be:
This command returns an array of information that’s used to display a standard file like dialog box on the Newton. Each element of the array is a frame describing one file, folder or device. The individual frame would look like this:
The possible values for type are desktop, file, folder or disk (0, 1, 2, 3). The frames should be in the order in the array that they are to be displayed in on the Newton. For example, the array might look like this:
If the type is a disk, then the frame will have an additional slot disktype with the values (floppy # 0, hardDrive # 1, cdRom # 2, netDrive # 3). Also, if the current location is the desktop, there is an additional slot whichvol to indicate the location of the inidvidual files, folders and disks with the values 0 for disks and a negative number for the volRefNum for files and folders on the desktop. If the item is an alias there is an alias slot. The existence of this slot indicates that the item is an alias.
This command is sent in response to a kDGetFileInfo command. It returns a frame that looks like this:
:kind is a description of the file. :size is the number of bytes (actual, not the amount used on the disk). :create is the creation date in newton date format. :modified is the modification date of the file. :icon is an icon to display. This is optional. :path is the “user understandable” path description
This command requests the newton to return info about the internal store. The result is described with the KDInternalStore command.
This command is sent by the desktop in response to the kDResolveAlias command. If the value is 0, the alias can’t be resolved. If the data is 1 (or non-zero) the alias can be resolved. File importingFile importing uses the file browsing interface described above. After the user taps the import button, the following commands are used. Newton -> Desktop Commands
Desktop -> Newton
Examples When the user taps the import button:
When there’s more than one translator available:
When there’s only one translator available:
When the data is ready to be sent to the Newton:
Newton -> Desktop Detailed Commands All commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command asks the desktop to import the file specified by the last path command and the filename string. The response to this can be either a list of translators (if there is more than one applicable translator) or an indication that importing is in progress. If the selected item is at the Desktop level, a frame {Name:“Business”, whichVol:-1} is sent. Otherwise, a string is sent.
This command specifies which translator the desktop should use to import the file. The translator index is the index into the translator list sent by the desktop in the kDTranslatorList command. The desktop should acknowledg this command with an indication that the import is proceeding. Desktop-> Newton Detailed Commands All commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command returns an array of translators that can be used with the specified file. The list can include DataViz translators and tab templates. The array should be in the order that the translators should be displayed in the list.
This command is sent to let the Newton know that an import operation is starting. The Newton will display an appropriate message after it gets this message.
This command returns information about what was imported into the Newton. Each array element specifies a soup and how many entries were added to it. There will typically be only one frame in the array. The frame will look like this:
This command can be used instead of kDSetCurrentStore. It sets the current store to the one the user has picked as the default store (internal or card). Package loadingPackage loading uses the file browsing interface described above. After the user taps the load package button, the following commands are used.
Examples After the load package button is tapped:
Newton -> Desktop Detailed Commands
This command asks the desktop to load the package specified by the last path command and the filename string. If the selected item is at the Desktop level, a frame {Name:“Business”, whichVol:-1} is sent. Otherwise, a string is sent. Restore originated on NewtonRestore uses the file browsing interface described above. After the user taps the restore button, the following commands are used. Newton -> Desktop Commands
Desktop -> Newton or Newton -> Desktop
Examples After the restore button is tapped:
Selective restore proceeds as a normal restore would except when it wants to restore a package. In this case it does this:
If the user picks a full restore it proceeds like this:
Newton -> Desktop Detailed Commands
This command asks the desktop to restore the file specified by the last path command and the filename. If the selected item is at the Desktop level, a frame {Name:“Business”, whichVol:-1} is sent. Otherwise, a string is sent.
This command is sent to the desktop if the user wants to do a selective restore. The desktop should return a kDRestoreOptions command.
This command is sent to the desktop if the user elects to restore all information. Merge is 0 to not merge, 1 to merge. Desktop -> Newton or Newton -> Desktop
This command is sent to the newton to specify which applications and packages can be restored. It is sent in response to a kDRestoreFile command from the Newton. If the user elects to do a selective restore the Newton returns a similar command to the desktop indicating what should be restored.
storeType indicates whether the data will be restored to a card (kRestoreToCard # 1) or the newton (kRestoreToNewton # 0).
This command sends all the entries associated with a package to the newton in a single array. Packages are made up of at least 2 entries: one for the package info and one for each part in the package. All of these entries must be restored at the same time to restore a working package. A kDResult is returned after the package has been successfully restored. Desktop Initiated Functions while connectedWith the advent of the new protocol, the Newton and the desktop can be connected, but with no command specified. A command can be requested by the user on either the Newton or the Desktop. Commands requested by the newton user are discussed above. This section describes the commands sent from the Desktop to the Newton in response to a user request on the desktop. Desktop -> Newton Commands
Desktop -> Newton Detailed Commands
This command is sent from the desktop when the desktop wants to start a sync operation, when both the newton and the desktop were waiting for the user to specify an operation.
This command is sent from the desktop when the desktop wants to start a restore operation, when both the newton and the desktop were waiting for the user to specify an operation.
This command is sent from the desktop when the desktop wants to start a load package operation, when both the newton and the desktop were waiting for the user to specify an operation. 1.0 Newton ROM SupportNewton -> Desktop Commands
Desktop -> Newton
Desktop -> Newton or Newton -> Desktop
Examples Every session starts like this:
No matter what the intent of the desktop or the Newton, these commands must always start a session (the desktop can substitute a kDResult for the kDSetTimeout if it doesn’t want to set the timeout). A typical synchronize session might continue like this:
A restore session would look like this:
A load package session would look like this:
Newton -> Desktop Detailed Commands All commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command is sent to a docker that the junior wishes to connect with (on the network, serial, etc.). The Newt expects a kDInitiateDocking command in response. The protocol version is the version of the messaging protocol that’s being used
This command sets the timeout for the connection (the time the Newton will wait to receive data for it disconnects). This time is usually set to 30 seconds.
This command is sent in response to a correct kDInitiateDocking command from the docker. The Newton’s name is used to locate the proper synchronize file. The version info includes things like machine type (e.g. J1), ROM version, etc.
This command is sent in response to a kDGetStoreNames command. It returns information about all the stores on the Newton. Each array slot contains the following information about a store:
This command is sent in response to a kDGetSoupNames command. It returns the names and signatures of all the soups in the current store.
This command specifies the indexes that should be created for the current soup.
This command is sent in response to a kDGetSoupIDs command. It returns all the IDs from the current soup.
This command is sent in response to a kDGetChangedIDs command. It returns all the ids with mod time > the last sync time. If the last sync time is 0, no changed entries are returned (this would happen on the first sync).
This command is sent in response to any of the commands from the PC that don’t request data. It lets the PC know that things are still proceeding OK.
This command is sent in response to a kDAddEntry command from the PC. It returns the ID that the entry was given when it was added to the current soup.
This command is sent in response to a KDReturnEntry command. The entry in the current soup specified by the ID in the KDReturnEntry command is returned.
This command sends a list of package frames to the desktop. For each package the information sent is this:
Note that this is not sent as an array! It’s sent as binary data. Note that this finds packages only in the current store.
This command sends a package to the pc. It’s issued repeatedly in response to a kDBackupPackages message. Desktop-> Newton Detailed CommandsAll commands begin with ’newt’, ‘dock’ so that’s not shown below.
This command is sent to the newt in response to a kDRequestToDock command. Session type can be one of {none, settingUp, synchronize, restore, loadPackage, testComm, loadPatch, updatingStores}.
This command is sent when a list of soup names is needed. It expects to receive a kDSoupNames command in response.
This command sets the current store on the Newton. A store frame is sent to uniquely identify the store to be set:
This command sets the current soup. Most of the other commands pertain to this soup so this command must preceed any command that uses the current soup. If the soup doesn’t exist a kDSoupNotFound error is returned but the connection is left alive so the desktop can create the soup if necessary. Soup names must be < 25 characters.
This command requests the definition of the indexes that should be created for the current soup.
This command is sent to request a list of entry IDs for the current soup. It expects to receive a kDSoupIDs command in response.
This command is sent to request a list of changed IDs for the current soup. It expects to receive a kDChangedIDs command in response.
This command is sent to delete one or more entries from the current soup.
This command is sent when the PC wants to add an entry to the current soup.
This command is sent when the PC wants to retrieve an entry from the current soup.
This command is sent when the PC wants to retrieve a changed entry from the current soup.
This command is used by restore to remove all entries from a soup before the soup data is restored.
This command is used by restore to delete a soup if it exists on the Newton but not on the PC.
This command will load a package into the Newton’s RAM. The package data should be padded to an even multiple of 4 by adding zero bytes to the end of the package data.
This command is sent to request a list of package ids. This list is used to remove any packages from the PC that have been deleted on the Newt.
This command is sent to backup any packages that are installed on the Newton. It expects a kDPackage command or a kDResponse with an error of 0 (to indicate that there are no more packages) in response.
This command is sent to the Newton when the docking operation is complete. Desktop -> Newton or Newton -> Desktop Detailed Commands
This command is sent by the newton in response to a KDReturnChangedEntry command from the desktop. It can also be sent by the desktop.
This command is sent during long operations to let the newton or desktop know that the connection hasn’t been dropped.
This command is used to send a soup info frame. When received the info for the current soup is set to the specified frame. CompatibilityThe protocol described above for 2.0 is a superset of the 1.0 protocol. However, the protocol version has been incremented so old versions of Newton Connection will no longer work with this version. The reason for this is that, although the protocol itself is upwardly compatable, the data structures in other parts of the 2.0 newton have changed to such a degree that old versions of Newton Connection will no longer work. NTK
|