getAttrib method

  1. @override
Tuple2<SCardResult, List<int>> getAttrib(
  1. int hCard,
  2. int dwAttrId
)
override

Implementation

@override
Tuple2<SCardResult, List<int>> getAttrib(int hCard, int dwAttrId) {
  final pcbAttrLen = calloc<DWORD>()..value = MAX_BUFFER_SIZE;
  final pbAttr = calloc<BYTE>(pcbAttrLen.value);

  try {
    var response = _winscard.SCardGetAttrib(hCard, dwAttrId, pbAttr, pcbAttrLen);
    var result = SCardResult(response);

    if( !result.isSuccess ) {
      return Tuple2(result, []);
    }

    var attributeList = _convertNativeBytes(pbAttr, pcbAttrLen.value);

    return Tuple2(result, attributeList);
  }
  finally {
    calloc.free(pbAttr);
    calloc.free(pcbAttrLen);
  }
}