The TMWriteAddFile API adds to an opened 'add' file specified by the file handle 'file_handle'. The ‘file_handle’ can be acquired with TMCreateFile for a new file or TMOpenFile for an existing ‘add’ file. An ‘add’ file is a file with extension 100 (decimal) that resides on an EPROM 1-Wire device. The ‘add’ file is special because the contents of the file can be added to without deleting and then rewriting it. The TMWriteAddFile API call has two modes of operation. It can append data to the end of the 'add' file or it can add data at an offset from the beginning of the file. The 'operation' flag is:
1 : Append to the file starting after the last programmed byte (not FF Hex) in the last page of the file.
0 : Write the data starting at the specified 'offset'. If there is data already there then the result will be to program any zeroes in the data. For instance:
00110101 current byte in device
01010111 data byte to program
Note that with this feature, individual bits can be programmed.
If the operation is 1 'append' then the 'offset' entry is not used. The data is provided in the 'write_buffer' and the length of the data to write is 'num_write' bytes.
For a description of the above types, see the TMEX Type Descriptions.
Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.
Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.
Specifies a file handle of the file to write.
Specifies the operation mode of appending to the end of the file (1) or writing at an offset (0).
Specifies the offset number of bytes from the beginning of the file if operation is 0 for offset mode.
Specifies a pointer to a buffer that contains the data to write to the file. It must be at least ‘num_write’ bytes long.
Specifies the number of bytes to write from the ‘write_buffer’.
Return Value>= 0 => file written, and this is the number of bytes