Indigresso Wiki

Open Source Stuff for DASH7

User Tools

Site Tools


opentag:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
opentag:api [2011/09/30 20:16]
jpnorair
opentag:api [2011/09/30 20:19] (current)
jpnorair [Logger]
Line 55: Line 55:
  
 ===== Logger ===== ===== Logger =====
 +//​[[opentag:​logger|Logger Main Article]]// \\
 The Logger echos to the MPipe whatever data is sent to it.  Most Logger functions are only available through the C API (they are defined in OTAPI_c.h and implemented in OTAPI_logger.c). ​ However, ALP usage of the Logger is permitted, and it maps always to otapi_log_raw(). The Logger echos to the MPipe whatever data is sent to it.  Most Logger functions are only available through the C API (they are defined in OTAPI_c.h and implemented in OTAPI_logger.c). ​ However, ALP usage of the Logger is permitted, and it maps always to otapi_log_raw().
  
 Logger functions do not apply the C API general form because they are special purpose functions that do not link to ALP or DASHForth (except for otapi_log_raw(),​ which behaves like echo). Logger functions do not apply the C API general form because they are special purpose functions that do not link to ALP or DASHForth (except for otapi_log_raw(),​ which behaves like echo).
  
- 
-=== otapi_log_direct(ot_u8* data) === 
-Log a datastream directly (no double buffering)\\ 
-Argument: data (ot_u8*) the pre-formatted datastream (NDEF)\\ 
-Returns: (ot_u16) 0 on failure, non-zero on non-failure 
- 
-This is the fastest way to log, but the data must be already formatted into logging format (for official ports, this is NDEF). The data pointed-to by the data parameter is not double-buffered into an output buffer, so use it cautiously. 
- 
- 
-=== otapi_log_raw(ot_int length, ot_u8* data) - [0x04:XX] === 
-Format and log a raw datastream\\ 
-Argument: length (ot_int) length in bytes of the supplied datastream\\ 
-Argument: data (ot_u8*) the arbitrary datastream\\ 
-Returns: (ot_u16) 0 on failure, non-zero on non-failure 
- 
-Takes a raw datastream (arbitrary payload bytes) and formats it into NDEF while double-bufferring the formatted stream for log output. 
- 
- 
-=== otapi_log_msg(ot_int label_len, ot_int data_len, ot_u8* label, ot_u8* data) === 
-Log arbitrary "​message,"​ which is type + data.\\ 
-Argument: label_len (ot_int) number of bytes/chars in the label\\ 
-Argument: data_len (ot_int) number of bytes/chars in the data\\ 
-Argument: label (ot_u8*) label byte array\\ 
-Argument: data (ot_u8*) data byte array\\ 
-Returns: (ot_u16) 0 on failure, non-zero on non-failure 
- 
-Similar to otapi_log_raw() except that a label string is applied to the datastream prior to the data payload. ​ The label string is zero-terminated,​ so it should take on ASCII values or similar. 
- 
- 
-=== otapi_log_code(ot_int label_len, ot_u8* label, ot_u16 code) === 
-Log a system code, such as an error code\\ 
-Argument: label_len (ot_int) number of bytes/chars in the label\\ 
-Argument: label (ot_u8*) label byte array\\ 
-Argument: code (ot_u16) an integer code\\ 
-Returns: (ot_u16) 0 on failure, non-zero on non-failure 
- 
-Similar to otapi_log_msg() and, by extension, otapi_log_raw(). Instead of a byte datastream, though, the data payload consists of a two-byte code value, which is translated to ASCII Hex on output. 
- 
-Note: parsing the payload on input via stdio.h can look like:\\ 
-scanf("​%s %04X", &​label_in,​ &​code_in);​ 
  
  
opentag/api.txt ยท Last modified: 2011/09/30 20:19 by jpnorair