2013å¹´
ä»å¹´ã®æ±è² ã§ãã¤ãã¤ãã¨â¦
å»å¹´ã®åç
2012å¹´ - ææ¥ã®éµ
http://d.hatena.ne.jp/tomorrowkey/20120126/132758834
ãã®ã¥ãã
çµå±æ¨å¹´ã¨åããããã
NFCããã°ã£ã¦ãã
Androidã¢ããªä»¥å¤ããã
ãµã¼ãç³»ããã£ãã
èªåãµã¼ãããã¦ã¦ãRedmineã使ãããã«ãªã£ãã
æ¯æã©ããããã®åæ¯ããã®ãææ¡ãã¦ãããã
moneylook 使ãå§ãã¦ã ãããå¢ãã¦ãã®ãæ¸ã£ã¦ãã®ãåããããã«ãªã£ãã
ã¬ã·ã¼ãåãåãã¯ç¶ç¶ä¸ã
éç¨çã«ã¯ãã¨ãã¨çµè²»ã§è½ã¨ããããªã¤ãã ããããããã«ãã¦ãã
ã¨ããããããã£ã¦ããã¦ããã¨ã§ä»åããã¹ã¿ã¤ã«ã«ããã
ãã«ãã©ã½ã³å®èµ°
ãã©ã½ã³ããããç³ãè¾¼ããã©ãçµå±ä¸ã¤ãã§ããªãã£ãã
ã¸ã ã§ã®ã©ã³ãã³ã°ã¯ã¹ãã¬ã¹çºæ£ã«ãã使ã£ã¦ãã
ã¸ã ã¯ããã
Google I/Oãã
è¡ã£ãã
楽ããã£ãã
ãããGoogle I/Oããã観å
ã®æ¹ã楽ããã£ãæãå¦ããªãã
ã¤ãã³ãèªä½ãããã¨ã³ã¸ãã¢ãããããéã¾ãã¨ãããã¨ã楽ããã
ã¤ã¾ã楽ããã
ä»å¹´ãããã°ã£ã¦è¡ãããã
åå¤å±ãã
è¡ãã¦ãªãã
ã¤é¨è¡ã£ã¦ã¿ãããªãããã
ç¦å²¡ãã
NFCã®ã¤ãã³ãã«è¡ã£ãã
まみちゃんãè¡ã£ãã
ï¼å¹´ã¶ãã ã£ããã©ãè¦ãã¦ã¦ããã¦å¬ããã£ãã
å±å°ãã¨ã£ã¦ã楽ããï¼ã¾ãè¡ãããã
ã¢ã°å±ãã
è¡ããã
å¹´æãã¦éããªãã¨ãå¹´è¶ãã«è¡ããã
ãã¼ã«å¤§ã¸ã§ãããã¯ãã©ã£ã¦ãããããªãã
ã¬ãããã¾ãã
ãã®ä»
æ°ããäºãå¦ã¹ããã¨æãèµ·ããã¨ããããªã«æ°ãããã¨ãã¦ããªãã¦
ç°å¢ãæ´ããæ¹ã«æ²¡é ãã¦ãã¾ã£ã¦ããã
ã¾ããã¢ã¦ãããããããããªãã
ãã©ã¤ãã¼ãã§ããã°ã¡ã¢ç¨åº¦ã®ãã®ãããã¤ãããã
å
¬éããªãã¨æå³ãªããªã¼ã
ããã°æ¸ãéãæ¸ã£ã¦ãããã
ä»å¹´ã®æ±è²
è±èª
è±èªãå¦ã¶ãã¨ã¯ç¶ç¶ã大åã ã¨ãå¤æ¹ããèãã
ä»å¹´ã®ååã¯èªå¦çå¦ã«è¡ãã®ã§ããããããã°ãã®ã¯ãã¡ããã ã
帰ã£ã¦ããå¾ã«ãã©ã®ããã«è±èªã¨ä»ãåããããèãããã
ä»äº
ããããã俺ãèªåã§ãã£ãã»ããæ©ãããããã£ã¦ããã®ã¯ããããã
èªåãçãç®ãè¦ãã
ä»äºã人ã«ä»»ããããããã«ãªãããã
æ è¡
ã¨ã¼ãããè¡ãããã
鹿å
島帰ãããã
å¼è¶ã
練馬ãããã©ãä¼ç¤¾ã¾ã§é ããã¼ã¼ã¼ã¼
移åæéã«æéåãããã®ã¯ããåå¼ï¼ï¼
ãé
æè¿ã財å¸ããããã
ããã°ããã
#
æé·ããã
0次çºè¡FeliCa Liteã«NDEFãæ¸ãè¾¼ã
ã¾ããã
Android Advent Calendar 2012 (表)ã®8æ¥ç®æ
å½ã®@tomorrowkey ã§ãï¼
è£ã¯ @rukiadia ããã§ãã
ããã°ãã¾ãï¼
ãããã¤
0次çºè¡ç¶æ
ã®FeliCa Liteã«NDEFãæ¸ãè¾¼ããã½ããã¦ã§ã¢ããªãã£ãã®ã§ãèªåã§ä½ãã¾ããã
Windowsã§ã¯PaSoRi+NDEFWriterã§ã1次çºè¡ç¶æ
ã«ããã¨åæã«NDEFãæ¸ãè¾¼ããã¨ãã§ãã¾ãã
NDEFãæ¸ãè¾¼ãããã«1次çºè¡ã¯å¿
é ã§ã¯ãªãã®ã§ã0次çºè¡ã®ç¶æ
ã§NDEFãæ¸ãè¾¼ããããã«ãã¾ããã
æã¤ãã³ãã§2,000æã®FeliCa Liteã«SmartPosterãæ¸ãè¾¼ãå¿
è¦ãããã¾ããã
å½åã¯PaSoRi+NDEFWriterã§ããããã¨æã£ãã®ã§ãã
1æã§ãæ¸ãè¾¼ãããã«URLãå
¥åãããããã¤ã¢ãã°ã®OKãã¿ã³ãæ¼ãããã¨
ãªãã¬ã¼ã·ã§ã³ãç
©éã ã£ãã®ã§ã¢ããªãä½ããé£ç¶ã§æ¸ãè¾¼ããããã«ããã®ã§ãã
ãã®æã¯ãã åãå¤ããããã°ããã£ãã®ã§ããã¸ãã¯ãã³ãã¼ã®åµã ã£ãã®ã§ãã
ä»åãå¤ãåçã«å¤ããããããã«ããã¨ããã¨ç¶ºéºãªã½ã¼ã¹ã«ãªãããã«æ¸ãç´ãã¾ããã
ã©ã¤ãã©ãªã¯ä½¿ã£ã¦ããããã¹ã¯ã©ãããã¦ãã¾ãã
ã¾ã ã¾ã æãæãã¦ãã¨ãããããããããã®ã§ããªãã¨ããããã§ãã
ã¦ãã¨ã¼ã§ãããããããã¯åæã®è§£èª¬ãªã©æ¸ãã¾ãã
ã¢ããªãFeliCa Liteã«åå¿ããããã«ãã
use-permission
NFCã使ãããã«permissionã®è¨å®ãå¿
è¦ã§ãã
/AndroidManifest.xml
<uses-permission android:name="android.permission.NFC" />
launchMode
NFCã®Intentã¯NEW_TASKãã¤ããç¶æ
ã§é£ãã§ãã¾ãã
ãã¡ãã¡æ°ããActivityãèµ·åããã¦ã¯ãããã®ã§
launchModeã«singleTaskãããã¯singleInstanceãæå®ãã¦é²ãã¾ãã
android:launchMode="singleTask"
enableForegroundDispatch
NFCãåå¿ãããåªå
ãã¦èªåã®ã¢ããªãèµ·åãããããã«foregroundDispatchã¨ããæ©è½ã使ãã¾ãã
ã¢ããªããã©ã¢ã°ã©ã¦ã³ãã«è¡¨ç¤ºããã¦ããç¶æ
ã§NFCãããã¯ãããã®ã§ãonResumeã«å¦çãæ¸ãã¾ãã
ãã¨ã§onPauseã«è§£é¤ããã³ã¼ããæ¸ãã°OKã§ãã
/src/jp/tomorrowkey/android/felicalitewriter/WriteActivity.java
@Override protected void onResume() { super.onResume(); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { Toast.makeText(getApplicationContext(), "not found NFC feature", Toast.LENGTH_SHORT) .show(); finish(); return; } if (!mNfcAdapter.isEnabled()) { Toast.makeText(getApplicationContext(), "NFC feature is not available", Toast.LENGTH_SHORT).show(); finish(); return; } PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()), 0); IntentFilter[] intentFilter = new IntentFilter[] { new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED), }; String[][] techList = new String[][] { { android.nfc.tech.NfcF.class.getName() } }; mNfcAdapter.enableForegroundDispatch(this, pendingIntent, intentFilter, techList); }
pendingIntentã«ã¯NFCã¿ã°ãæ¤åºããæã«æãã¦æ¬²ããIntentãå
¥ãã¦ããã¾ãã
IntentFilterã¨techListã«ã¯æ¤åºãããNFCã¿ã°ã®ç¨®é¡ãæå®ãã¾ãã
IntentFilterã®Actionã«ã¯
- ACTION_NDEF_DISCOVERED
- NDEFãã©ã¼ããããããNFCã¿ã°
- ACTION_TECH_DISCOVERED
- NDEFãã©ã¼ãããããã¦ããªãã¿ã°ã®ä¸ã§ãã¿ã°ã®ç¨®é¡æå®ãã§ãã
- ACTION_TAG_DISCOVERED
- ã©ããªã¿ã°ã§ãããããæ¤åºãã
techListã«ã¯ã¿ã°ã®ç¨®é¡ãæå®ãã¾ãã
ä»åã¯FeliCa Liteã ãã«å¯¾å¿ãããã®ã§
- Actionã«ACTION_TECH_DISCOVERED
- techListã«NfcF
ãæå®ãã¾ãã
disableForegroundDispatch
ã¢ããªãããã¯ã°ã©ã¦ã³ãã«å
¥ã£ãã¨ãã«ã¯ãNFCããã¯ããªãã¦ããã®ã§
æå¹ã«ããforegroundDispatchãç¡å¹ã«ãã¾ãã
@Override public void onPause() { super.onPause(); mNfcAdapter.disableForegroundDispatch(this); }
FeliCa ã®ä»æ§ã«ã¤ãã¦
ããã¾ã§ä½ãã¨Activity#onNewIntent(:intent)ã«NFCã¿ã°ã®æ
å ±ãé£ãã§ããããã«ãªãã¾ãã
ExtraããTagãå¼ã£å¼µã£ã¦NDEFãæ¸ãããããããã§ãã
ä¸ã«ã¯æ¸ããªãFeliCa Liteã¿ã°ãããã¾ãã
ããã¯NDEFãã©ã°ããã£ã¦ããªããã®ã§ãã*1
é販çã§è³¼å
¥ããFeliCa Liteã¿ã°ã¯ããã¦ããã£ã¦ããªãç¶æ
ã§ãï¼ãããã¾ãã§ããï¼
ã¤ã¾ããNDEFãã©ã°ãç«ã¦ãã°ããããã§ãã
Android SDKã§ã¯ãFeliCa Liteã®NFCãã©ã°ããã¦ãæ©è½ãã¤ãã¦ãã¾ããã
èªåã§ãããããã¦ãå¿
è¦ãããã¾ãã
ãã®ããã«FeliCa Liteã®ä»æ§ã«ã¤ãã¦ç¥ãå¿
è¦ãããã¾ãã
ããã°ããã
FeliCaä»æ§æ¸
FeliCaã®ä»æ§æ¸ã¯Sonyã®ãµã¤ãã«ããã¾ãã
FeliCaã«ã¼ã ã¦ã¼ã¶ã¼ãºããã¥ã¢ã« æç²ç http://www.sony.co.jp/Products/felica/business/tech-support/index.html?j-short=tech-support#Standard01
FeliCa Liteã¦ã¼ã¶ã¼ãºããã¥ã¢ã« http://www.sony.co.jp/Products/felica/business/tech-support/index.html?j-short=tech-support#Lite01
ä¸è¬çãªã³ãã³ãã®ä½å
ã³ãã³ãé· : 1 Byte
å
é ã«å
¨ä½ã®ã³ãã³ãé·ãå
¥ãã¾ãã
ããã¯ã³ãã³ãé·ãæ ¼ç´ãã1Byteãå«ã¿ã¾ãã
ããå¿ãã¾ãã
ã³ãã³ã : 1 Byte
ã³ãã³ããæå®ãã¾ãã
FeliCa Liteã®ä»æ§æ¸ã«è¼ã£ã¦ããã³ãã³ãã¯ä»¥ä¸ã®ãã®ã®ã¿ã§ãã
- Polling
- 0x00
- Read Without Encryption
- 0x06
- Write Without Encryption
- 0x08
FeliCa Standardã«ã¯ãããããããã¾ãã
IDm : 8 Byte
ã³ãã³ãã«ããã¾ããããã®ãã¨ã«ã¯ã ãããIDmãå
¥ãã¾ãã
IDmã¨ã¯FeliCaã¿ã°ã²ã¨ã¤ã²ã¨ã¤ã§ä¸æã«èå¥ã§ããIDã®ãã¨ã§ãã
製é çªå·ã¿ãããªãã®ã§ãåãéä¿¡é åå
ã«è¤æ°ã®FeliCaã¿ã°ããã£ãéã«
éä¿¡ç¸æãé¸ã¶ããã«ä½¿ããã¾ãã
æ¸ãè¾¼ã¿ã³ãã³ãã«ã¤ãã¦
FeliCa Liteã«ã¯ä»¥ä¸ã®ãããªå¶éãããã¾ãã
- ä¸åº¦ã«æ¸ãè¾¼ãããããã¯æ°ã¯1ã¤ã¾ã§
- ãµã¼ãã¹ã³ã¼ãã¯0x0009ã«åºå®
- ã¢ã¯ã»ã¹ã¢ã¼ãã¯000ã«åºå®
- ãµã¼ãã¹ã³ã¼ãé çªã¯0000ã«åºå®
FeliCa Standardã¨æ¯ã¹ãã°èãããã¨ãå°ãªãã¦æ¥½ã§ãã
以ä¸ã®ãã¨ãè¸ã¾ãã¦æ¸ãè¾¼ã¿ã³ãã³ããå®è£
ããã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
/** * Write Without Encryptionã³ãã³ããçºè¡ãã¾ã<br> * FeliCa Liteãªã®ã§ã1度ã®ã³ãã³ãçºè¡ã§1ãããã¯ã ãæ¸ãè¾¼ãã¾ã * * @param idm IDm * @param blockNumber ãããã¯çªå· * @param data æ¸ãè¾¼ã¿ãã¼ã¿ * @return ã¬ã¹ãã³ã¹ * @throws TagLostException * @throws IOException */ public byte[] writeWithoutEncryption(byte[] idm, int blockNumber, byte[] data) throws TagLostException, IOException { if (idm == null || idm.length == 0) throw new IllegalArgumentException(); ByteBuffer byteBuffer = ByteBuffer.allocate(31); // Write Without Encryption byteBuffer.put((byte)0x08); // IDm byteBuffer.put(idm); // ãµã¼ãã¹æ° // FeliCa Liteãªã®ã§1ã«åºå® byteBuffer.put((byte)0x01); // ãµã¼ãã¹ã³ã¼ãï¼ãªãã«ã¨ã³ãã£ã¢ã³ï¼ // 0x00 0x09 byteBuffer.put((byte)0x09); byteBuffer.put((byte)0x00); // ãããã¯ãªã¹ã // é·ã 2Byteãªã®ã§1b // ã¢ã¯ã»ã¹ã¢ã¼ã FeliCa Liteãªã®ã§000bã«åºå® // ãµã¼ãã¹ã³ã¼ãé çª FeliCa Liteãªã®ã§0000bã«åºå® // ãããã¯çªå· å¼æ°ããæå® byteBuffer.put((byte)0x80); byteBuffer.put((byte)blockNumber); // æ¸ãè¾¼ã¿ãã¼ã¿ byteBuffer.put(data); byte[] command = byteBuffer.array(); byte[] response = executeCommand(command); return response; }
ã³ãã³ãé·ã¯ã³ãã³ãçºè¡ç´åã«ä»å ããããã¯ã¶ãã¦ããã¾ãã
FeliCa Liteã®ã¡ã¢ãªãããã«ã¤ãã¦
ããã§æ¸ãè¾¼ã¿ã³ãã³ãçµç«ã¯å®æãã¾ããã
次ã«ã©ãã«ãªã«ãæ¸ãã°ããã調ã¹ã¾ãã
FeliCa Liteã®ã¡ã¢ãªãããã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã
ï¼ãããFeliCa Liteã®ä»æ§æ¸ã«æ¸ããã¦ãã¾ãï¼
S_PADã¨æ¸ãããé¨åããã¦ã¼ã¶ã¼ãããã¯ã¨å¼ã°ããå ´æã§
ããã«ãã¾ãã¾ãªãã¼ã¿ãæ¸ãè¾¼ã¿ã¾ãã
ãã®ã»ãã®é åã¯ãããããªå½¹å²ãæ©è½ãããã®ã§è©³ããã¯ä»æ§æ¸ãåèã«ãã¦ãã ããã
ã¦ã¼ã¶ãããã¯ä»¥å¤ã«ããããå¿
è¦ã«ãªãã®ã
MCãããã¯ï¼ã¡ã¢ãªã¼ã³ã³ãã£ã°ã¬ã¼ã·ã§ã³ãããã¯ï¼ã§ãã
MCãããã¯ã®SYS_OP(System Option)ã«0x01ãæå®ãããã¨ã§
FeliCa LiteãNDEFåããã¾ãã
é常ã¯0x00ã§ãã
FeliCa Liteã®NDEFãã©ã°ããã¦ã
ãã£ããæ¸ãè¾¼ã¿ã³ãã³ãã使ã£ã¦NDEFåãã¾ãã
// NDEFåãã¾ã byte[] data = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, }; felicaLiteTag.writeWithoutEncryption(idm, 0x88, data);
MCãããã¯ã«æ¸ãè¾¼ã¿ããã®ã§ããããã¯çªå·ã«0x88ãæå®ã
ãã¼ã¿ã«ï¼ãããã¯åã®ãã¼ã¿ãæå®ãã¾ãã
ä¸åº¦ã®æ¸ãè¾¼ã¿ã§ï¼ãããã¯ãã¹ã¦ãæå®ããªããã°ãªãã¾ããã
ãã®ãããã¯ã®ä¸ã«ã¯ä¸åº¦ç¹å®ã®å¤ãæ¸ãè¾¼ãã¨ãäºåº¦ã¨ãã®å¤ãå¤æ´ã§ããªãç®æãããã¾ãã
ã§ãã®ã§ãæ°ãã¤ãã¦æ¸ãè¾¼ã¿ã¾ãããã
æ¬æ¥ã§ããã°ç¾å¨ã®ãããã¯ãã¼ã¿ãèªã¿è¾¼ãã§SYS_OPã®é¨åã ãå¤æ´ããã»ãããããã ãã©
æãæãã¾ããã
NDEFãã¼ã¿ãä½ã
ã¿ã°ã®ã¡ã¿ãã¼ã¿ã£ã½ãã¨ããã¯NDEFã«å¯¾å¿ã§ãããã
ä»åº¦ã¯ãã¼ã¿æ¬ä½ãä½ãã¾ãã
Androidã¯NFC対å¿ï¼ã ãªãã¦è¬³ã£ã¦ããããã ãããNDEFã®åãã©ã¼ããããã«ãã¼ãããç¨æããã¦ãããªã¼ã£ã¦
æã£ããã§ãããããã¾ããã
ä»æ§æ¸ãèªãã§èªåã§ä½ãããã©ããããã²ãã£ã¦ãã¾ãããã
NDEFä»æ§æ¸ã¯NFC Forumã«ããã¾ãã
NDEFã«ã¤ãã¦ã¯'NFC Data Exchange Format (NDEF) Technical Specification' ã¨ããä»æ§æ¸
RTDã«ã¤ãã¦ã¯'Record Type Definition Technical Specifications' ã®åä»æ§æ¸
ãåèã«ãã¦ãã ããã
NFC Forum : Technical Specifications http://www.nfc-forum.org/specs/spec_list/
以åNDEFã«ã¤ãã¦çºè¡¨ããã¨ãã®è³æã¯ãããã
é¿ãã¦ã¯éããªããã¤ããªå°ç - NDEFã£ã¦ãªãã ãã - http://www.slideshare.net/tomorrowkey/ndef-13784268
é¿ãã¦ã¯éããªããã¤ããªå°ç - NDEFã£ã¦ãªãã ãã - http://www.slideshare.net/tomorrowkey/ndef-13784268
ã¡ãªã¿ã«èº«è¿ãªã¨ããã§NDEFãã¼ã¿ãä½ããµã³ãã«ã¨ãã¦ã¯
ApiDemosã«RTD-Textãä½ãã³ã¼ããå
¥ã£ã¦ãã¾ãã
NDEFãã¼ã¿ãã§ãããæ¸ãè¾¼ã¿ã¾ãã
NDEFãã©ã°ãå¤æ´ããæã¨åãè¦é ã§ãã
NDEFããããä½æãã
ãã¼ã¿ãã§ããã¨ããã§ãS_PADï¼ã¹ã¯ã©ãããããï¼ã«æ¸ãè¾¼ã¿ããã¨ããã§ãã
ãã®ã¾ã¾æ¸ãã¦ãNDEFã ã¨èªèãã¦ããã¾ããã
å®ã¯S_PAD0ãAttribute Information Blockã«ããªãã¨ãããªãããã§ãã
ãã®ã¸ãã®ä»æ§ã¯NFC Forumã«å®ç¾©ããã¦ãã¾ãã
FeliCaç³»ã®ã¿ã°ã¯NFC Forumã§ã¯Type 3ã¨ãªã£ã¦ããã®ã§
NFC Forum Type 3 Tag Operation Specification
ã¨ããä»æ§æ¸ãè¦ã¦ã¿ãã¨æ¸ãã¦ããã¾ãã
NFC Forum : Technical Specifications http://www.nfc-forum.org/specs/spec_list/
- Ver
ãã¼ã¸ã§ã³ãæå®ãã¾ãã
1.0ã表ã0x10ãæå®ãã¾ãã
- Nbr
ã¿ã°èªã¿åãæã«ãä¸åº¦ã«èªãããããã¯æ°ãæå®ãã¾ãã
FeliCa Liteãªã®ã§0x04ãæå®ãã¾ãã
- Nbw
ã¿ã°æ¸ãè¾¼ã¿æã«ãä¸åº¦ã«æ¸ãè¾¼ãããããã¯æ°ãæå®ãã¾ãã
FeliCa Liteãªã®ã§0x01ãæå®ãã¾ãã
- Nmaxb
NDEFãã¼ã¿ã¨ãã¦ä½¿ãããããã¯æ°ãæå®ãã¾ãã
13ãããã¯ãªã®ã§0x00 0x0Dãæå®ãã¾ãã
- WriteF
ãã¼ã¿ã¯ä¸ã¤ã®ã¿ã°ã«åã¾ãã®ã§ã0x00ãæå®ãã¾ãã
- RW Flag
ä»å¾ãæ¸ãè¾¼ã¿ã§ããç¶æ ãªã®ã§ã0x01ãæå®ãã¾ãã
- Ln
NDEFãã¼ã¿ã®é·ããæå®ãã¾ãã
å®éã®ãã¼ã¿é·ããè¨å®ããã¾ãã
- Checksum
ãã§ãã¯ãµã ã§ãã
ãããã¯0ã®ãã¹ã¦ãå ç®ããå¤ãè¨å®ãã¾ãã
private byte[] createNdefHeader(int ndefLength) { ByteBuffer buffer = ByteBuffer.allocate(16); // Ver buffer.put((byte)0x10); // Nbr // Read Without Encrypitonã§ä¸åº¦ã«èªãããããã¯æ°ãæå®ãã¾ã // FeliCa Liteãªã®ã§ãä¸åº¦ã«4ãããã¯èªã¿è¾¼ãã buffer.put((byte)0x04); // Nbw // Write Without Encryptionã§ä¸åº¦ã«æ¸ãè¾¼ãããããã¯æ°ãæå®ãã¾ã // FeliCa Liteãªã®ã§ãä¸åº¦ã«1ãããã¯æ¸ãè¾¼ãã buffer.put((byte)0x01); // Nmaxb // NDEFã¨ãã¦ä½¿ç¨ã§ãããããã¯æ° // FeliCa Liteãªã®ã§ããã¼ã¿é åã¯13ãããã¯ã¾ã§ buffer.put((byte)0x00); buffer.put((byte)0x0d); // unused buffer.put((byte)0x00); buffer.put((byte)0x00); buffer.put((byte)0x00); buffer.put((byte)0x00); // WriteF // ä¸æã§å®çµãã¦ããã®ã§ã0x00 buffer.put((byte)0x00); // RW Flag // Read Writeãªã®ã§0x01 buffer.put((byte)0x01); // Ln // NDEFãã¼ã¿ã®é·ããæå®ãã¾ã buffer.put((byte)((ndefLength >>> 16) & 0xff)); buffer.put((byte)((ndefLength >>> 8) & 0xff)); buffer.put((byte)(ndefLength & 0xff)); // Checksum // ãã§ãã¯ãµã ãæå®ãã¾ã buffer.put(checksum(buffer.array())); return buffer.array(); } /** * ãã§ãã¯ãµã ãä½æãã¾ã<br> * ãã¹ã¦ã®ãã¤ãé åã®åè¨ãè¨ç®ãã¾ã * * @param byteArray * @return */ private byte[] checksum(byte[] byteArray) { int sum = 0; for (byte b : byteArray) { sum += b & 0xff; } return new byte[] { (byte)((sum >>> 8) & 0xff), (byte)(sum & 0xff) }; }
NDEFãã¼ã¿ãæ¸ãè¾¼ã
ããã§ããã¹ã¦ã®ææã¯æãã¾ããã
ã¦ã¼ã¶ã¼ãããã¯ã®0ããé ã«ãã¼ã¿ãæ¸ãè¾¼ã¿ã¾ãã
/** * NdefMessageãæ¸ãè¾¼ã¿ã¾ã * * @param idm IDm * @param ndefMessage NDEF * @throws SizeOverflowException NdefMessageã®ãµã¤ãºã大ããããå ´åã«çºçãã¾ã * @throws TagLostException * @throws IOException */ public void writeNdefMessage(byte[] idm, NdefMessage ndefMessage) throws SizeOverflowException, TagLostException, IOException { if (idm == null || idm.length == 0) throw new IllegalArgumentException(); if (ndefMessage == null) throw new IllegalArgumentException(); byte[][] datas = mappingBlock(ndefMessage); for (int blockNumber = 0; blockNumber <= 13; blockNumber++) { // FIXME ã¬ã¹ãã³ã¹ãæ¡ãã¤ã¶ãã¦ããã®ã§ãã©ãã«ããã writeWithoutEncryption(idm, blockNumber, datas[blockNumber]); } } /** * NdefMessageããFeliCa Liteã®åãããã¯ã«ãããã³ã°ãã¾ã * * @param ndefMessage * @return * @throws SizeOverflowException * @throws IOException */ private byte[][] mappingBlock(NdefMessage ndefMessage) throws SizeOverflowException, IOException { byte[] ndefMessageBytes = ndefMessage.toByteArray(); int ndefMessageBytesLength = ndefMessageBytes.length; int blockCount = (int)Math.ceil(ndefMessageBytesLength / 16.0); if (blockCount > 13) throw new SizeOverflowException(ndefMessageBytesLength, 16 * 13); byte[][] datas = new byte[14][16]; datas[0] = createNdefHeader(ndefMessageBytesLength); ByteArrayInputStream inputStream = new ByteArrayInputStream(ndefMessageBytes); try { inputStream = new ByteArrayInputStream(ndefMessageBytes); int readLength; for (int i = 1; i < datas.length; i++) { readLength = inputStream.read(datas[i]); if (readLength == -1) break; } } finally { try { if (inputStream != null) inputStream.close(); } catch (IOException e) { // ignore } } return datas; }
å®æ
ããã§NDEFãæ¸ããããããã«ãªãã¾ããã
ãã®ããã§ããã
ã½ã¼ã¹ã³ã¼ãã¯ããã«æãã¦ããã¾ãã
https://github.com/tomorrowkey/FeliCaLiteWriter
æå¾ã«
ææ¥ã¯Nexus 7ããªããªãå±ããªããã¨ã§æåãª@sekitoba ããã¨
@sugimotoak ããã§ãã
ã¿ããªããã°ãã¼
*1:ã¦ã¼ã¶ã¼ã¨ãªã¢ãReadOnlyã«å¤æ´ããã¦ããå ´åãããã¾ã
ããã¿ã«ãã¿ã³ã表示ãã4.0
4.0以åã¯ãã¡ã
ããã¿ã«ãã¿ã³ã表示ãã - ææ¥ã®éµ http://d.hatena.ne.jp/tomorrowkey/20110809/1312869978
ãã¿ã³2ã¤
ãã®ç»é¢ã®ã¬ã¤ã¢ã¦ããã¡ã¤ã«ã¯ã©ããªã£ã¦ãããã½ã¼ã¹ãæ¢ã
uninstall_confirm.xml
<!-- OK confirm and cancel buttons. --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:divider="?android:attr/dividerHorizontal" android:showDividers="beginning" android:paddingTop="16dip"> <LinearLayout style="?android:attr/buttonBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:measureWithLargestChild="true"> <LinearLayout android:id="@+id/leftSpacer" android:layout_weight="0.25" android:layout_width="0dip" android:layout_height="wrap_content" android:orientation="horizontal" android:visibility="gone" /> <Button android:id="@+id/cancel_button" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_weight="1" android:text="@string/cancel" android:maxLines="2" style="?android:attr/buttonBarButtonStyle" /> <Button android:id="@+id/ok_button" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_weight="1" android:text="@string/ok" android:maxLines="2" style="?android:attr/buttonBarButtonStyle" /> <LinearLayout android:id="@+id/rightSpacer" android:layout_width="0dip" android:layout_weight="0.25" android:layout_height="wrap_content" android:orientation="horizontal" android:visibility="gone" /> </LinearLayout> </LinearLayout>
ãã¿ã³1ã¤
軽ãæ¢ãããã©ãã ãããActionBarã§å®ç¾ãã¦ãã¿ãã
ã¬ã¤ã¢ã¦ãã§å®è£
ããããªã以ä¸ã§ããã£ã½ãã§ãã
<LinearLayout style="?android:attr/buttonBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:measureWithLargestChild="true" android:orientation="horizontal" > <Button android:id="@+id/done_button" style="?android:attr/buttonBarButtonStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableLeft="@drawable/ok" android:drawableRight="@drawable/space" android:maxLines="2" android:text="@string/done" /> </LinearLayout>
ä¹ææ¡å ãæ¤ç´¢ããã¢ããªãä½ã£ãã
ç°¡åã«ä½¿ããä¹ææ¡å
ã¢ããªãä½ãã¾ããã
æ¯åé§
åãå
¥åãã¦ãæ¤ç´¢ããããªãã¦ããã©ãã§ãã
ãã¤ã使ãã«ã¼ããäºãç»é²ãã¦ããã°ããã¨ã¯é¸æããã ãã§
ä»ã®æéã§æ¤ç´¢ãã¦ããã¾ã
æ¤ç´¢çµæãããããä¿åãªãã¦ããã©ãã§ãã
æ¤ç´¢ãããèªåçã«ä¿åãã¦ããã¾ã
ãã¦ã³ãã¼ã
https://market.android.com/details?id=jp.tomorrowkey.android.transitguide
ãµã¤ã
Androidã¢ã㪠ä¹ææ¡å
https://sites.google.com/site/androidtrainguide/
ãã®ä»ã¹ã¯ãªã¼ã³ã·ã§ãã
Javaã®æ£è¦è¡¨ç¾ããã¹ããããµã¤ããä½ã£ãã
ä½ã£ã
Java regex tester http://java-regex-tester.appspot.com/
Javaã®æ£è¦è¡¨ç¾ãè©ä¾¡ãããµã¤ããä½ã£ããã
使ã£ãã©ã¤ãã©ãªã¨ã
Slim3
https://sites.google.com/site/slim3appengine/
GAEã ã¨slim3ä¸æ
jQuery: The Write Less, Do More, JavaScript Library
http://jquery.com/
jQueryãªãã¨javascriptãããã©ã
zClip :: jQuery ZeroClipboard
http://www.steamdev.com/zclip/
ã¯ãªãããã¼ãã«ã³ãã¼ããããã®jQueryãã©ã°ã¤ã³
Adventures in Programming » Blog Archive » Toast Notifications Using jQuery
http://shawntabai.com/wp/2011/09/06/toast-notifications-using-jquery/
Androidã®Toastã©ã¤ã¯ãªè¡¨ç¤ºãããããã®ã³ã¼ã
Google Web Fonts
http://www.google.com/webfonts
Gudeaã¨ãããã©ã³ãã使ãã¾ããã
ãã§ãã¯ããã¯ã¹ãã¤ãã¦ãã³ã¼ããã³ãã¼ããã ããªãã§ã¨ã¦ãç°¡åã§ãã
è¦ãç®
ããã°ã£ã¦CSSæ¸ãããã©ãBootstrap使ã£ã¦ãã£ãããããããªã¼ã
ãã¼ãfaviconã ããã
ãã¨ã¯è±GAEãããã
æ´æ°ãã¾ãã
- æ£è¦è¡¨ç¾ã¨ã©ã¼ã ã£ãå ´åã«ã¬ã¹ãã³ã¹ã帰ã£ã¦ããªãä¸å ·åãç´ãã¾ãã
- Bootstrap使ãã¾ãã
- Matchesã表示ããããã«ãã¾ãã
- Groupã®ãã¤ã©ã¤ããè²åããã¾ãã
2012-02-05 20:45 追è¨
æ´æ°ãã¾ãã
- Findããã¹ã¦æ½åºãããªããã°ãä¿®æ£ãã¾ãã
2012-02-07 08:49 追è¨
ã½ã¼ã¹ãå ¬éãã¾ãã
tomorrowkey/RegularExpressionTester - GitHub https://github.com/tomorrowkey/RegularExpressionTester
ããå æ¸ã©ã¤ã»ã³ã¹ã®è¡¨è¨ãã¡ããã¨ããªãã¨ãªã¼
2012-02-09 08:40 追è¨
2012å¹´
ãã¾ããä»å¹´ã®æ±è² ã§ãæ¸ã
å»å¹´ã®åçãã
- ããã¾ããã®ã¥ãããã¦ãªãã£ãã
- éãã§ã°ããã ã£ãã
- ã©ãã ããéãããã®ãææ¡ãã¦ãªãã£ãã
- çµè²»ã§è½ã¨ããããªã¤ãã¯é åæ¸ãããçãã§ããã
- é¨å±ã®çä»ãã§ããã
- 貯éã§ããã
- ãã¤ã¯è²·ã£ãã
- å®å®¶å¸°ããã
ä»å¹´ã®æ±è²
- ãã®ã¥ããããã°ã
- Androidã¢ããªä»¥å¤ããã
- æ¯æã©ããããã®åæ¯ããã®ãææ¡ãã¦ãããã
- ãã«ãã©ã½ã³å®èµ°
- Google I/Oãã
- åå¤å±ãã
- ç¦å²¡ãã
- ã¢ã°å±ãã
#
ãã§ã«1æ2æã§éãã§ã°ãããªãã ãã©ãå¬ã¯ãããããªãï¼
æ¥ããæ¬æ°åºã
RealViewSwitcherãä½ãã¾ãã
Android Advent Calendar
ãã®ã¨ã³ããªã¯Android Advent Calendarã®ã¨ã³ããªã®ï¼ã¤ã§ãã
ã¯ãªã¹ãã¹ã¾ã§ã«ï¼æ¥ï¼è¨äºæ´æ°ãããã®ã§ããã²ã覧ã«ãªã£ã¦ãã ããã
Android Advent Calendar http://androidadvent.blogspot.com/
RealViewSwitcherãä½ãã¾ãã
Launcherã¢ããªã®ããã«ã1ãã¼ã¸ãã¨ã«åãæ¿ããViewGroupãä½ãã¾ããã
ãã§ã«compatibility packageã§ViewPagerãå
¬éããã¦ãã¾ãã
ãããä½ã£ãå½æã¯ãã¾ã compatibility packageãããã¾ããã§ããã
RealViewSwitcherã¨ããViewGroupã§ãã
"RealViewSwitcher"ã§æ¤ç´¢ããã¨åããããªã¯ã©ã¹ãã§ã¦ãã¾ãããç§ã«å½åã»ã³ã¹ããªãã®ã§ååã ãæåãã¾ããã
ãã§ã«デコ美ãシンプルQRコードã«ã¤ã³ããªããã¦ãã¾ãã
åç»
3ã¤ãã¼ã¸ãããããããã循ç°ãã¾ãã
ãã¡ããããªãã¯ãã以å¤ã«ã³ã³ããã¼ã«ã追å ãããã¨ãå¯è½ã§ãã
ã°ãã¼ãã®æåãå¤æ´ãããã¨ãå¯è½ã§ãã
ç°¡åãªä½¿ãæ¹
ã³ã¼ãããåçã«Viewã®è¿½å ãå¯è½ã§ãããxmlã«ãè¨è¿°ã§ãã¾ãã
é常ã®ç¬èªViewã¨åãããæ¹ã§ãã
<?xml version="1.0" encoding="utf-8"?> <view xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/jp.tomorrowkey.android.realviewswitchersample" android:id="@+id/viewSwitcher" android:layout_width="match_parent" android:layout_height="match_parent" class="jp.tomorrowkey.android.realviewswitcher.widget.RealViewSwitcher" app:interpolator="overshoot_interpolator" > <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/color1" android:gravity="center" android:text="1" android:textSize="64sp" /> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/color2" android:gravity="center" android:text="2" android:textSize="64sp" /> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/color3" android:gravity="center" android:text="3" android:textSize="64sp" /> </view>
ã°ãã¼ãã®æåãå¤æ´ãããå ´åã«éãã
xmlns:app="http://schemas.android.com/apk/res/使ç¨ããã¢ããªã®ããã±ã¼ã¸å"
ã¨
app:interpolator="overshoot_interpolator"
ãå¿
è¦ã§ãã
interpolatorã«è¨å®å¯è½ãªãªã¹ãã¯ããã«å®ç¾©ããã¦ãã¾ãã
RealViewSwitcher/res/values/attrs.xml at master from tomorrowkey/RealViewSwitcher - GitHub https://github.com/tomorrowkey/RealViewSwitcher/blob/master/RealViewSwitcher/res/values/attrs.xml
注æç¹
人ã«ãã£ã¦ããªãã¯ããã¨ãã®æè¦ãéãã¨æãã®ã§ãé¾å¤ã®èª¿æ´ãå¿
è¦ã§ãã
ãã²ãã³ã¼ããèªãã§èª¿æ´ãã¦ã¿ã¦ãã ããã
ãµã³ãã«ã¢ããª
ã½ã¼ã¹ã³ã¼ã
tomorrowkey/RealViewSwitcher - GitHub
https://github.com/tomorrowkey/RealViewSwitcher