Changeset 1290 for branches/smartreader/csctapi/ct_slot.c
- Timestamp:
- 01/19/10 16:48:50 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/csctapi/ct_slot.c
r1280 r1290 117 117 char CT_Slot_Probe (CT_Slot * slot, BYTE * userdata, unsigned length) 118 118 { 119 PPS * pps;119 //PPS * pps; 120 120 BYTE buffer[PPS_MAX_LENGTH]; 121 121 unsigned buffer_len = 0; … … 138 138 if (slot->icc_type == CT_SLOT_ICC_ASYNC) 139 139 { 140 pps = PPS_New(); 141 142 if (pps == NULL) 140 PPS_New(); 141 142 /* Prepare PPS request */ 143 if ((userdata != NULL) && (length > 0)) 144 memcpy (buffer, userdata, buffer_len = MIN(length, PPS_MAX_LENGTH)); 145 146 /* Do PPS */ 147 if (PPS_Perform (buffer, &buffer_len) != PPS_OK) 143 148 { 144 149 ICC_Async_Close (); 145 150 146 slot->icc = NULL;147 slot->icc_type = CT_SLOT_NULL;148 return ERR_MEMORY;149 }150 151 /* Prepare PPS request */152 if ((userdata != NULL) && (length > 0))153 memcpy (buffer, userdata, buffer_len = MIN(length, PPS_MAX_LENGTH));154 155 /* Do PPS */156 if (PPS_Perform (pps, buffer, &buffer_len) != PPS_OK)157 {158 PPS_Delete (pps);159 160 ICC_Async_Close ();161 162 slot->icc = NULL;163 151 slot->icc_type = CT_SLOT_NULL; 164 152 slot->protocol_type = CT_SLOT_NULL; … … 167 155 } 168 156 169 slot->protocol_type = (PPS_GetProtocolParameters (pps))->t; 170 slot->protocol = PPS_GetProtocol (pps); 171 172 173 PPS_Delete (pps); 157 slot->protocol_type = (PPS_GetProtocolParameters ())->t; 174 158 } 175 159 … … 183 167 ret = OK; 184 168 185 if (slot->protocol_type == CT_SLOT_PROTOCOL_T0)186 {187 if (Protocol_T0_Close ((Protocol_T0 *) slot->protocol) != PROTOCOL_T0_OK)188 ret = ERR_TRANS;189 190 Protocol_T0_Delete ((Protocol_T0 *) slot->protocol);191 }192 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T1)193 {194 if (Protocol_T1_Close ((Protocol_T1 *) slot->protocol) != PROTOCOL_T1_OK)195 ret = ERR_TRANS;196 197 Protocol_T1_Delete ((Protocol_T1 *) slot->protocol);198 }199 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T14)200 {201 if (Protocol_T14_Close ((Protocol_T14 *) slot->protocol) != PROTOCOL_T14_OK)202 ret = ERR_TRANS;203 204 Protocol_T14_Delete ((Protocol_T14 *) slot->protocol);205 }206 207 slot->protocol = NULL;208 169 slot->protocol_type = CT_SLOT_NULL; 209 170 … … 214 175 } 215 176 216 slot->icc = NULL;217 177 slot->icc_type = CT_SLOT_NULL; 218 178 … … 227 187 if (slot->protocol_type == CT_SLOT_PROTOCOL_T0) /* T=0 protocol ICC */ 228 188 { 229 if (Protocol_T0_Command ( 189 if (Protocol_T0_Command (cmd, rsp) != PROTOCOL_T0_OK) 230 190 ret = ERR_TRANS; 231 191 else … … 234 194 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T1) /* T=1 protocol ICC */ 235 195 { 236 if (Protocol_T1_Command ( (Protocol_T1 *) slot->protocol,cmd, rsp) != PROTOCOL_T1_OK)196 if (Protocol_T1_Command (cmd, rsp) != PROTOCOL_T1_OK) 237 197 ret = ERR_TRANS; 238 198 else … … 241 201 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T14) /* T=14 protocol ICC */ 242 202 { 243 if (Protocol_T14_Command (cmd, rsp) != PROTOCOL_T 14_OK)203 if (Protocol_T14_Command (cmd, rsp) != PROTOCOL_T0_OK) 244 204 ret = ERR_TRANS; 245 205 else … … 266 226 { 267 227 return slot->icc_type; 268 }269 270 void * CT_Slot_GetICC (CT_Slot * slot)271 {272 return slot->icc;273 228 } 274 229 … … 301 256 ret = OK; 302 257 303 if (slot->protocol_type == CT_SLOT_PROTOCOL_T0)304 {305 if (Protocol_T0_Close ((Protocol_T0 *) slot->protocol) != PROTOCOL_T0_OK)306 ret = ERR_TRANS;307 308 Protocol_T0_Delete ((Protocol_T0 *) slot->protocol);309 }310 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T1)311 {312 if (Protocol_T1_Close ((Protocol_T1 *) slot->protocol) != PROTOCOL_T1_OK)313 ret = ERR_TRANS;314 315 Protocol_T1_Delete ((Protocol_T1 *) slot->protocol);316 }317 else if (slot->protocol_type == CT_SLOT_PROTOCOL_T14)318 {319 if (Protocol_T14_Close ((Protocol_T14 *) slot->protocol) != PROTOCOL_T14_OK)320 ret = ERR_TRANS;321 322 Protocol_T14_Delete ((Protocol_T14 *) slot->protocol);323 }324 325 258 if (slot->icc_type == CT_SLOT_ICC_ASYNC) 326 259 { … … 348 281 static void CT_Slot_Clear (CT_Slot * slot) 349 282 { 350 slot->icc = NULL;351 slot->protocol = NULL;352 283 slot->icc_type = CT_SLOT_NULL; 353 284 slot->protocol_type = CT_SLOT_NULL;
Note:
See TracChangeset
for help on using the changeset viewer.