0

I have created my own QX10 client app which just published to store. (available on Windows Phone Store: http://www.windowsphone.com/en-us/store/app/nc-qx10/1c8d71da-0e4b-43cd-a5c2-020a072419d3 and it's being open sourced here: https://github.com/nantcom/SonyCameraSDK {not synced yet, still cleaning up code...}) and my next step is to get Camera Password from NFC.

After a few trials, I have small success in reading NFC tag embedded on my QX10 using NdefLibrary. And here is what I can get from my QX10:

Mime Type:

application/x-sony-pmm

Payload:

\0\0\0\0DIRECT-qdQ0:DSC-QX10\0\*********\0\n\0��\0\0\n\0\0����ɇ\v\0\0\0�@/\0\n\0\0�A\nDmsRmtDesc\0\0

I can see the SSID of my QX10 and the location that was masked with **** is my QX10 password, so this is a possible way to get the password from QX10.

However, the payload seems to have some specific format which I have been trying to find for about 2 hours. I can simply substring to get the password but it does not seems to be very reliable as it might be different on other camera.

Is there any published specification about this Ndef Record type, So I can reliably read the SSID/Password from it?

1 Answers1

0

Nice app! Although I can't help you directly I used some code from Thibaud Michel (https://github.com/ThibaudM/timelapse-sony) to get my app working with the NFC connection for Android:

Here's the java method which handles obtaining the password from the payload:

private static Pair<String, String> decodeSonyPPMMessage(NdefRecord ndefRecord) {

        if(!SONY_MIME_TYPE.equals(new String(ndefRecord.getType()))) {
            return null;
        }

        try { 
            byte[] payload = ndefRecord.getPayload(); 
            Log.v("pay",String.valueOf(payload));
            int ssidBytesStart = 8;
            int ssidLength = payload[ssidBytesStart];

            byte[] ssidBytes = new byte[ssidLength];
            int ssidPointer = 0;
            for (int i=ssidBytesStart+1; i<=ssidBytesStart+ssidLength; i++) {
                ssidBytes[ssidPointer++] = payload[i];
            }
            String ssid = new String(ssidBytes);

            int passwordBytesStart = ssidBytesStart+ssidLength+4;
            int passwordLength = payload[passwordBytesStart];

            byte[] passwordBytes = new byte[passwordLength];

            int passwordPointer = 0;
            for (int i=passwordBytesStart+1; i<=passwordBytesStart+passwordLength; i++) {
                passwordBytes[passwordPointer++] = payload[i];
            }
            String password = new String(passwordBytes);

            return new Pair<String, String>(ssid, password);

        } catch(Exception e) {
            return null;
        }
    }

You can see we end up with a string called password which is the password we want :). I don't have a windows phone/ visual studio on hand to test any C#/C++ code. Hopefully it's pretty simple rewriting it for windows phone.

Pete
  • 597
  • 1
  • 8
  • 27