to colorize a colorful pixel with a simple touch using nfc technology

Dependencies:   Chainable_RGB_LED mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mac_link.h Source File

mac_link.h

00001 
00002 
00003 #ifndef __MAC_LINK_H__
00004 #define __MAC_LINK_H__
00005 
00006 #include "PN532.h "
00007 
00008 class MACLink {
00009 public:
00010     MACLink(PN532Interface &interface) : pn532(interface) {
00011 
00012     };
00013     
00014     /**
00015     * @brief    Activate PN532 as a target
00016     * @param    timeout max time to wait, 0 means no timeout
00017     * @return   > 0     success
00018     *           = 0     timeout
00019     *           < 0     failed
00020     */
00021     int8_t activateAsTarget(uint16_t timeout = 0);
00022 
00023     /**
00024     * @brief    write a PDU packet, the packet should be less than (255 - 2) bytes
00025     * @param    header  packet header
00026     * @param    hlen    length of header
00027     * @param    body    packet body
00028     * @param    blen    length of body
00029     * @return   true    success
00030     *           false   failed
00031     */
00032     bool write(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0);
00033 
00034     /**
00035     * @brief    read a PDU packet, the packet will be less than (255 - 2) bytes
00036     * @param    buf     the buffer to contain the PDU packet
00037     * @param    len     lenght of the buffer
00038     * @return   >=0     length of the PDU packet 
00039     *           <0      failed
00040     */
00041     int16_t read(uint8_t *buf, uint8_t len);
00042 
00043     uint8_t *getHeaderBuffer(uint8_t *len) {
00044         return pn532.getBuffer(len);
00045     };
00046     
00047 private:
00048     PN532 pn532;
00049 };
00050 
00051 #endif // __MAC_LINK_H__