API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also

This module provides the general logging interface for the AEE layer.
There are three primary LOGGER implementations; a single one is chosen by the application writer by creating an ILogger instance with one of the following class ID's:
AEECLSID_LOGGER_FILE: sends log items to a file.
AEECLSID_LOGGER_SERIAL: sends log items to the serial port.
AEECLSID_LOGGER_WIN: sends log items to the BREW Simulator output window.
Both the file and serial logger implementations output data to their respective output mediums in the following BREW packet format:

   | BREW Header | Packet data |

But, the serial logger wraps these BREW log packets in an HDLC frame as follows:

  | BREW Header | Packet Data | 16b FCS | 8b HDLC flag |

- The 16 bit FCS (Frame Check Sequence) is a 16 bit CRC as specified in RFC 1171
- The 8 bit HDLC flag has the value 0x7E, if this flag is found in the BREW Header,
Packet Data, or the 16b FCS it must be escaped with the 8 bit value 0x7D and xor'd with 0x20. In addition, the escape value 0x7D must also be escaped in the same mannor if found.
For example:

         In the data -> In the ouput stream
            0x7E     -> 0x7D,0x5E
            0x7D     -> 0x7D,0x5D

These values must then be unescaped by the receiving software.
When logging to the serial port there may be a delay between when the ILogger interface indicates that the packet has been sent successfully and when the packet is completely sent out the serial port. This is due to buffering delays introduced by the lower level serial interface. For this reason the application developer should be aware that if the ILogger interface is released too soon after the last packet has been sent, the packet received over the serial port may be truncated. To avoid this, a delay may be introduced between when the last packet is sent and when the ILogger interface is released.
The Win implementation of the ILogger interface writes all outgoing logs to the BREW output window using the following format


   bkt:            log bucket
   typ:            log type
   cID:            classId of currently running BREW application
   iID:            user defined instance ID
   FILENAME:       Optional file name where log was sent
   LINENUMBER:     Optional line number where log was sent
   MESSAGE:        User defined text message
   ARGS:           Optional arguments using ILOGGER_PutMsg()

When compiling a release version of a BREW applet the constant AEE_LOG_DISABLE may be defined which using the preprocessor remove all ILogger interface logging functions except the instance creation process and getting and setting parameters. This constant MUST be defined before the BREW application includes AEELogger.h.
Create an logger interface to log the messages. Using logger interface, one can send messages either to a file or to a simulator output window or to a serial port. Also we can configure the parameters like portID, Filename... using ILoggerSetParam function.