Skip to content

Instantly share code, notes, and snippets.

@miguelcardo
Last active August 29, 2015 14:10
Show Gist options
  • Save miguelcardo/3c35f015b2c8a6b0c002 to your computer and use it in GitHub Desktop.
Save miguelcardo/3c35f015b2c8a6b0c002 to your computer and use it in GitHub Desktop.
Sending an operation
// Read block 1 of sector 1 of the virtual MIFARE card
public int readBlock(String sessionId, HashMap<String, String> pendingOperations) {
String url = "https://api.fidesmo.com/mifare/read";
String callbackUrl = Constants.rootUrl + Constants.readBlockCallbackUrl;
// Encode the JSON structure with the trailer data for one sector
JSONObject payload = new JSONObject();
JSONArray blockData = new JSONArray();
blockData.add(Utils.encodeBlockToRead(1, 1));
payload.put("blocks", blockData);
return sendOperationAndProcessResponse(url, callbackUrl, payload, sessionId, pendingOperations);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment