本帖最后由 atxtk 于 2013-08-13 16:38:42 编辑

解决方案 »

  1.   

    翻译这段代码也不用学好C++,会一点点就行了。public  driver:^nfc_driver;
    nfc_driver 这个record 你定义了没有,代码在哪里
      

  2.   

    /**
     * NFC device
     */
    typedef struct nfc_device nfc_device;/**
     * NFC device driver我就巨晕! 自己定义自己的别名! 
      

  3.   

     
    nfc-types.h
    里的定义!但有点怪!
      * NFC device
      */
     typedef struct nfc_device nfc_device; /**
      * NFC device driver
    nfc-internal.hstruct nfc_device {
       const nfc_context *context;
       const struct nfc_driver *driver;
       void *driver_data;
       void *chip_data;   /** Device name string, including device wrapper firmware */
       char    name[DEVICE_NAME_LENGTH];
       /** Device connection string */
       nfc_connstring connstring;
       /** Is the CRC automaticly added, checked and removed from the frames */
       bool    bCrc;
       /** Does the chip handle parity bits, all parities are handled as data */
       bool    bPar;
       /** Should the chip handle frames encapsulation and chaining */
       bool    bEasyFraming;
       /** Should the chip switch automatically activate ISO14443-4 when
           selecting tags supporting it? */
       bool    bAutoIso14443_4;
       /** Supported modulation encoded in a byte */
       uint8_t  btSupportByte;
       /** Last reported error */
       int     last_error;
     };
       nfc_device =record
     public nfc_context:^Tnfc_context;
     public  driver:^nfc_driver;    //这里有问题!
    driver_data:Pointer;
      

  4.   

    struct nfc_driver {
      const char *name;
      const scan_type_enum scan_type;
      size_t (*scan)(const nfc_context *context, nfc_connstring connstrings[], const size_t connstrings_len);
      struct nfc_device *(*open)(const nfc_context *context, const nfc_connstring connstring);
      void (*close)(struct nfc_device *pnd);
      const char *(*strerror)(const struct nfc_device *pnd);  int (*initiator_init)(struct nfc_device *pnd);
      int (*initiator_init_secure_element)(struct nfc_device *pnd);
      int (*initiator_select_passive_target)(struct nfc_device *pnd,  const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt);
      int (*initiator_poll_target)(struct nfc_device *pnd, const nfc_modulation *pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t btPeriod, nfc_target *pnt);
      int (*initiator_select_dep_target)(struct nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout);
      int (*initiator_deselect_target)(struct nfc_device *pnd);
      int (*initiator_transceive_bytes)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, int timeout);
      int (*initiator_transceive_bits)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar);
      int (*initiator_transceive_bytes_timed)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, uint32_t *cycles);
      int (*initiator_transceive_bits_timed)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles);
      int (*initiator_target_is_present)(struct nfc_device *pnd, const nfc_target *pnt);  int (*target_init)(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout);
      int (*target_send_bytes)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout);
      int (*target_receive_bytes)(struct nfc_device *pnd, uint8_t *pbtRx, const size_t szRxLen, int timeout);
      int (*target_send_bits)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar);
      int (*target_receive_bits)(struct nfc_device *pnd, uint8_t *pbtRx, const size_t szRxLen, uint8_t *pbtRxPar);  int (*device_set_property_bool)(struct nfc_device *pnd, const nfc_property property, const bool bEnable);
      int (*device_set_property_int)(struct nfc_device *pnd, const nfc_property property, const int value);
      int (*get_supported_modulation)(struct nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
      int (*get_supported_baud_rate)(struct nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
      int (*device_get_information_about)(struct nfc_device *pnd, char **buf);  int (*abort_command)(struct nfc_device *pnd);
      int (*idle)(struct nfc_device *pnd);
      int (*powerdown)(struct nfc_device *pnd);
    };括号表示啥?
      

  5.   

      size_t (*scan)(const nfc_context *context, nfc_connstring connstrings[], const size_t connstrings_len);是不是 = function scan(nfc_context:context, nfc_connstring:connstrings[], size_t connstrings_len:DWORD);
      

  6.   

     struct nfc_device *(*open)(const nfc_context *context, const nfc_connstring connstring); 这行应该是 返回值是个nfc_device?
      

  7.   

     function initiator_target_is_present(pnd:Tpnd;pnt:pnfc_target):Integer;
    //   int (*target_init)(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout);
      function target_init(pnd:Tpnd;pnt:pnfc_target;pbtRx:^Byte;szRx:DWORD;timeout:Integer):Integer;
      //  int (*target_send_bytes)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout);
      function target_send_bytes(pnd:Tpnd;pbtTx:^Byte;szTx:DWORD;timeout:Integer):Integer;
      // int (*target_receive_bytes)(struct nfc_device *pnd, uint8_t *pbtRx, const size_t szRxLen, int timeout);
      function target_receive_bytes(pnd:Tpnd;pbtRx:^Byte;szRxLen:DWORD;timeout:Integer):Integer;
    //  int (*target_receive_bits)(struct nfc_device *pnd, uint8_t *pbtRx, const size_t szRxLen, uint8_t *pbtRxPar);
      function target_receive_bits(pnd:Tpnd;pbtRx:^Byte;szRxLen:DWORD;pbtRxPar:^Byte):Integer;
    //   int (*device_set_property_bool)(struct nfc_device *pnd, const nfc_property property, const bool bEnable);
      function device_set_property_bool(pnd:Tpnd;Pproperty:nfc_property;bEnable:boolean):Integer;
    // int (*device_set_property_int)(struct nfc_device *pnd, const nfc_property property, const int value);
      function device_set_property_int(pnd:Tpnd;Pproperty:nfc_property;value;Integer):Integer;
    // int (*get_supported_modulation)(struct nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
    **const supported_mt的是一个静态指针的指针!