SlideShare a Scribd company logo
1 of 28
Download to read offline
X



SDK for FeliCa & Adobe® AIR ® /Adobe ® Flash ®
       によるアプリケーション開発


                                                  2010/01/29

                                                  ソニー株式会社
                                            FeliCaデバイス事業部
                                                     竹村 航


                  © 2009 Sony Corporation
FeliCaを使ったことある人?

FeliCaでプログラミングしたことのある人?

ActionScript開発者?(Flash派? Flex派?)



                          © 2009 Sony Corporation
どのように実現しているのか

 Flash/AIRアプリケーションからUSB接続されたリーダ/ライタへは直接制御でき
 ない
 FeliCa Proxy Service という常駐プロセスを経由することで実現
   あらかじめクライアントPCにインストールされている必要がある
   FeliCa Port Software (ドライバ、ツールなどの基本的なソフトウェア一式)に含まれてい
   る


              localhost内での                  USB
              Socket通信

  Flash/AIR                  FeliCa Proxy
                                                  リーダ/ライター
 アプリケーション                      Service


                                                     無線



                                                    カード



                                                     © 2009 Sony Corporation
Flash/AIRとFeliCa Proxy Serviceとの通信

  Flash/AIRアプリケーションから送信したリクエストはFeliCa Proxy Serivceに処理
  される。
  処理結果のレスポンスは非同期にイベント通知される。
             ① 非同期イベントを待ち受けるリスナ
             をaddEventListener()で登録する。


                       Flash/AIR アプリケーション
    ② リクエストを送信する。
                                                   ⑤ あらかじめ指定したリスナーが呼
                                                   び出されることで、結果を取得できる。




                                                 ④ レスポンスを送信
③ リーダー/ライターやカードへコマ
ンドを送信。コマンドの処理結果を
受ける。

                          FeliCa Proxy Service




                                                              © 2009 Sony Corporation
アプリケーション開発の流れ
SDK for FeliCa & Adobe® AIR® / Adobe® Flash®の基本的な手順の理解する為に
簡単なFlashアプリケーションとして、ボタンをクリックすると「FeliCa機能搭載の携帯電話の
ブラウザを起動させる」というFlashアプリケーションを作成します。



 1.   初期化
 2.   FeliCaProxyServiceと認証を行なう
 3.   「FeliCa機能搭載の携帯電話のブラウザを起動させる」APIの実行する
 4.   FeliCaProxyServiceとの認証を切断する




                                                     © 2009 Sony Corporation
初期化

  SDKで提供されているクラスをインポートします。

import com.sony.felica.*;
import com.sony.jp.felica.event.*;



  FeliCaControlオブジェクトを作成します。

private var fc:FeliCaControl = new FeliCaControl();




                                                      © 2009 Sony Corporation
FeliCaProxyServiceとの認証

    FeliCaAccessクラスのopenメソッドでソケット接続の要求を行います。

private function init():void
{


     fc.open(10250);
}                      10250はポート番号ですが、必ず
                         この値を指定してください。




                                               © 2009 Sony Corporation
FeliCaProxyServiceとの認証

    openメソッド呼び出しの前に、open成功時に呼び出されるリスナを登録します。

private function init():void
{
     fc.addEventListener(OpenStatusEvent.OPEN_COMPLETE, onOpenComplete);
     fc.open(10250);
                                      openが成功したときに通知される非同期イベント。
}                                   失敗したときに通知されるイベント(OPEN_FAILURE)もある。


private function onOpenComplete(evt:OpenStatusEvent):void
{
     mx.controls.Alert.show(“open成功”);
}




                                                                © 2009 Sony Corporation
携帯電話のブラウザ起動

    MobileFeliCaRequestを初期化し、FeliCa Proxy Service に送信します。

private function sendURL():void
{

                                            携帯電話内部の機能の起動を要
                                              求するためのリクエスト

     var request:MobileFeliCaRequest = new MobileFeliCaRequest();
     request.type = MobileFeliCaRequest.WEBTO;
                                                     「ブラウザの起動」の他には、「iア
     request.url = “http://www.google.co.jp/m”;       プリの起動」、「共通領域の読み
                                                          込み」がある
     fc.access(request);
}
               リクエストをFeliCa Proxy Service
                      に送信




                                                                 © 2009 Sony Corporation
携帯電話のブラウザ起動

    open()と同様、access()呼び出しの前にリスナを登録します。

private function sendURL():void
                                        この他にエラー用のイベントが2種類ある
{
     fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE,
                           onAccessComplete);
     var request:MobileFeliCaRequest = new MobileFeliCaRequest();
     request.type = MobileFeliCaRequest.WEBTO;
     request.url = “http://www.google.co.jp/m”;
     fc.access(request);
}


private function onAccessComplete(evt:FeliCaStatusEvent):void
{
    mx.control.Alert.show(“完了”);
}




                                                                © 2009 Sony Corporation
FeliCaProxyServiceの切断

    最後に、FeliCa Control クラスのclose()メソッドを呼び出します。

private function onAccessComplete(evt:FeliCaStatusEvent):void
{
    mx.control.Alert.show(“完了”);
     fc.close();
}




                                                                © 2009 Sony Corporation
カード補足
  デモ



        © 2009 Sony Corporation
FeliCa検知 (Polling)

  リーダー/ライターにかざされたカードを検知することができ
  る
  検知時に取得できるデータ
     IDm
     PMm
  IDmは概ねユニークなので、セキュリティを必要としないのな
  らば利用可能




                           © 2009 Sony Corporation
NFC Type3 Tag
 を利用した例



                © 2009 Sony Corporation
NFC, Type3 Tag

 NFC
 NFC Forumが定める近距離通信の国際規格です。FeliCaはNFCに対応していま
 す。




 Type3 Tag
 NFCが定めるタグの一つ。
    タグとは?
      カードの一種
      少メモリ、安価
      様々な形状




                                      © 2009 Sony Corporation
Type3 Tag への書き込み、読み込み

    基本的には、MobileFeliCaRequest()の例と同様です

private function writeTag():void
{
     fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE,
                           onWriteComplete);
     var request:NFCType3TagRequest = new NFCType3TagRequest();
     request.type = NFCType3TagRequest.WRITE;
     request.data = “0123456789” // 16進数で表記
     fc.access(request);
}


private function onWriteComplete(evt:FeliCaStatusEvent):void
{
    mx.control.Alert.show(“書き込み完了”);
}




                                                                  © 2009 Sony Corporation
Type3 Tag への書き込み、読み込み

    基本的には、MobileFeliCaRequest()の例と同様です

private function readTag():void
{
     fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE,
                           onWriteComplete);
     var request:NFCType3TagRequest = new NFCType3TagRequest();
     request.type = NFCType3TagRequest.READ;
     fc.access(request);
}


private function onReadComplete(evt:FeliCaStatusEvent):void
{
    var response:NFCType3TagResponse = evt.object as NFCType3TagResponse;
     mx.control.Alert.show(response.data);
}




                                                                  © 2009 Sony Corporation
Type3 Tag に書き込めるデータフォーマット

 Type3 Tag 自体は書き込むデータフォーマットを定義しない
    単なる208バイトのスクラッチパッドとしても扱える
 NFC では複数の Record Type Definition (RTD) が定義されている
    Smart Poster – URL情報などを記録し、かざした対象機器上でウェブ
    サイトへ誘導
 Smart Poster 形式を使えばFeliCa Launcherと連携してウェブサイトへの
 誘導ができる




                                         © 2009 Sony Corporation
NFC Forum からダウンロード可能な資料




                          © 2009 Sony Corporation
FeliCa Plug
を利用した例



              © 2009 Sony Corporation
FeliCa Plug とは

  機器に組み込み、リーダー/ライターとデータ転送をすることが可能
  リーダー/ライターからはFeliCaカードと同様にアクセスすることが可能


FeliCa Plug 内蔵歩数計
  アコーズ開発
  過去15日分のデータをFeliCaで送信




                                     © 2009 Sony Corporation
FeliCaプリクラ
     デモ


             © 2009 Sony Corporation
このように処理しています
                                  wataru-takemura.com


 ① 写真を撮る

           ② サーバーに送信

                       ③ URLを返す




                  ④ WebTo機能でURL       ⑤ URLへアクセス
                  を送信




                                               © 2009 Sony Corporation
(最後に)
FeliCaって言ったら
電子マネーでしょ?


           © 2009 Sony Corporation
電子マネーの対応状況

 Edyの履歴表示機能が利用可能
    Edy番号
    残高
    使用金額、時間
 マッシュアップできそうなメタデータは今のところ利用できな
 い・・・
    利用した店舗情報
    購入した商品名
                                第一回FeliCaナイトより

                     「利用した駅、店舗をGoogle Map上に表示する
                     アプリ」を作りたい

 「Edyの購入履歴とHotpepper APIをマッシュ
アップしておすすめ店舗の検索するサービス」


                                          © 2009 Sony Corporation
FeliCaの使い方提案

 IDとして
   セキュリティを必要としないならばIDm
 携帯電話とのインターフェース
   送信できるデータ量は少ないが、サーバー連携でできることが増えそ
   う
 Tag
   不特定多数に配布してサイト誘導
 FeliCa Plug組み込み機器とのインターフェース
   健康器具の履歴をオンライン管理
   玩具を使ったソーシャルアプリ




                               © 2009 Sony Corporation
開発上の注意

 エラー処理について
 エラー時に発生するイベントに対するリスナを登録し、エラー時の処理を適切に
 行ってください。エラー要因としては以下のようなものがあります。
  FeliCa Proxy Service が起動していない
  リーダー/ライタが接続されていない、正しく認識されていない
  必要なソフトウェアがインストールされていない (FeliCa Port Software)
  カードがかざされていない
  通信エラー
 連続してリクエストを送信しない
 複数のリクエストを送信する場合には、
  リクエストはキューされません
  非同期イベントの到着を待って、次のリクエストを送信してください




                                                  © 2009 Sony Corporation
© 2009 Sony Corporation

More Related Content

Recently uploaded

スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 

Recently uploaded (10)

スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Felica Night 20090129(sony Felica) No2

  • 1. X SDK for FeliCa & Adobe® AIR ® /Adobe ® Flash ® によるアプリケーション開発 2010/01/29 ソニー株式会社 FeliCaデバイス事業部 竹村 航 © 2009 Sony Corporation
  • 3. どのように実現しているのか Flash/AIRアプリケーションからUSB接続されたリーダ/ライタへは直接制御でき ない FeliCa Proxy Service という常駐プロセスを経由することで実現 あらかじめクライアントPCにインストールされている必要がある FeliCa Port Software (ドライバ、ツールなどの基本的なソフトウェア一式)に含まれてい る localhost内での USB Socket通信 Flash/AIR FeliCa Proxy リーダ/ライター アプリケーション Service 無線 カード © 2009 Sony Corporation
  • 4. Flash/AIRとFeliCa Proxy Serviceとの通信 Flash/AIRアプリケーションから送信したリクエストはFeliCa Proxy Serivceに処理 される。 処理結果のレスポンスは非同期にイベント通知される。 ① 非同期イベントを待ち受けるリスナ をaddEventListener()で登録する。 Flash/AIR アプリケーション ② リクエストを送信する。 ⑤ あらかじめ指定したリスナーが呼 び出されることで、結果を取得できる。 ④ レスポンスを送信 ③ リーダー/ライターやカードへコマ ンドを送信。コマンドの処理結果を 受ける。 FeliCa Proxy Service © 2009 Sony Corporation
  • 5. アプリケーション開発の流れ SDK for FeliCa & Adobe® AIR® / Adobe® Flash®の基本的な手順の理解する為に 簡単なFlashアプリケーションとして、ボタンをクリックすると「FeliCa機能搭載の携帯電話の ブラウザを起動させる」というFlashアプリケーションを作成します。 1. 初期化 2. FeliCaProxyServiceと認証を行なう 3. 「FeliCa機能搭載の携帯電話のブラウザを起動させる」APIの実行する 4. FeliCaProxyServiceとの認証を切断する © 2009 Sony Corporation
  • 6. 初期化 SDKで提供されているクラスをインポートします。 import com.sony.felica.*; import com.sony.jp.felica.event.*; FeliCaControlオブジェクトを作成します。 private var fc:FeliCaControl = new FeliCaControl(); © 2009 Sony Corporation
  • 7. FeliCaProxyServiceとの認証 FeliCaAccessクラスのopenメソッドでソケット接続の要求を行います。 private function init():void { fc.open(10250); } 10250はポート番号ですが、必ず この値を指定してください。 © 2009 Sony Corporation
  • 8. FeliCaProxyServiceとの認証 openメソッド呼び出しの前に、open成功時に呼び出されるリスナを登録します。 private function init():void { fc.addEventListener(OpenStatusEvent.OPEN_COMPLETE, onOpenComplete); fc.open(10250); openが成功したときに通知される非同期イベント。 } 失敗したときに通知されるイベント(OPEN_FAILURE)もある。 private function onOpenComplete(evt:OpenStatusEvent):void { mx.controls.Alert.show(“open成功”); } © 2009 Sony Corporation
  • 9. 携帯電話のブラウザ起動 MobileFeliCaRequestを初期化し、FeliCa Proxy Service に送信します。 private function sendURL():void { 携帯電話内部の機能の起動を要 求するためのリクエスト var request:MobileFeliCaRequest = new MobileFeliCaRequest(); request.type = MobileFeliCaRequest.WEBTO; 「ブラウザの起動」の他には、「iア request.url = “http://www.google.co.jp/m”; プリの起動」、「共通領域の読み 込み」がある fc.access(request); } リクエストをFeliCa Proxy Service に送信 © 2009 Sony Corporation
  • 10. 携帯電話のブラウザ起動 open()と同様、access()呼び出しの前にリスナを登録します。 private function sendURL():void この他にエラー用のイベントが2種類ある { fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE, onAccessComplete); var request:MobileFeliCaRequest = new MobileFeliCaRequest(); request.type = MobileFeliCaRequest.WEBTO; request.url = “http://www.google.co.jp/m”; fc.access(request); } private function onAccessComplete(evt:FeliCaStatusEvent):void { mx.control.Alert.show(“完了”); } © 2009 Sony Corporation
  • 11. FeliCaProxyServiceの切断 最後に、FeliCa Control クラスのclose()メソッドを呼び出します。 private function onAccessComplete(evt:FeliCaStatusEvent):void { mx.control.Alert.show(“完了”); fc.close(); } © 2009 Sony Corporation
  • 12. カード補足 デモ © 2009 Sony Corporation
  • 13. FeliCa検知 (Polling) リーダー/ライターにかざされたカードを検知することができ る 検知時に取得できるデータ IDm PMm IDmは概ねユニークなので、セキュリティを必要としないのな らば利用可能 © 2009 Sony Corporation
  • 14. NFC Type3 Tag を利用した例 © 2009 Sony Corporation
  • 15. NFC, Type3 Tag NFC NFC Forumが定める近距離通信の国際規格です。FeliCaはNFCに対応していま す。 Type3 Tag NFCが定めるタグの一つ。 タグとは? カードの一種 少メモリ、安価 様々な形状 © 2009 Sony Corporation
  • 16. Type3 Tag への書き込み、読み込み 基本的には、MobileFeliCaRequest()の例と同様です private function writeTag():void { fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE, onWriteComplete); var request:NFCType3TagRequest = new NFCType3TagRequest(); request.type = NFCType3TagRequest.WRITE; request.data = “0123456789” // 16進数で表記 fc.access(request); } private function onWriteComplete(evt:FeliCaStatusEvent):void { mx.control.Alert.show(“書き込み完了”); } © 2009 Sony Corporation
  • 17. Type3 Tag への書き込み、読み込み 基本的には、MobileFeliCaRequest()の例と同様です private function readTag():void { fc.addEventListener(FeliCaStatusEvent.FELICA_ACCESS_COMPLETE, onWriteComplete); var request:NFCType3TagRequest = new NFCType3TagRequest(); request.type = NFCType3TagRequest.READ; fc.access(request); } private function onReadComplete(evt:FeliCaStatusEvent):void { var response:NFCType3TagResponse = evt.object as NFCType3TagResponse; mx.control.Alert.show(response.data); } © 2009 Sony Corporation
  • 18. Type3 Tag に書き込めるデータフォーマット Type3 Tag 自体は書き込むデータフォーマットを定義しない 単なる208バイトのスクラッチパッドとしても扱える NFC では複数の Record Type Definition (RTD) が定義されている Smart Poster – URL情報などを記録し、かざした対象機器上でウェブ サイトへ誘導 Smart Poster 形式を使えばFeliCa Launcherと連携してウェブサイトへの 誘導ができる © 2009 Sony Corporation
  • 20. FeliCa Plug を利用した例 © 2009 Sony Corporation
  • 21. FeliCa Plug とは 機器に組み込み、リーダー/ライターとデータ転送をすることが可能 リーダー/ライターからはFeliCaカードと同様にアクセスすることが可能 FeliCa Plug 内蔵歩数計 アコーズ開発 過去15日分のデータをFeliCaで送信 © 2009 Sony Corporation
  • 22. FeliCaプリクラ デモ © 2009 Sony Corporation
  • 23. このように処理しています wataru-takemura.com ① 写真を撮る ② サーバーに送信 ③ URLを返す ④ WebTo機能でURL ⑤ URLへアクセス を送信 © 2009 Sony Corporation
  • 25. 電子マネーの対応状況 Edyの履歴表示機能が利用可能 Edy番号 残高 使用金額、時間 マッシュアップできそうなメタデータは今のところ利用できな い・・・ 利用した店舗情報 購入した商品名 第一回FeliCaナイトより 「利用した駅、店舗をGoogle Map上に表示する アプリ」を作りたい 「Edyの購入履歴とHotpepper APIをマッシュ アップしておすすめ店舗の検索するサービス」 © 2009 Sony Corporation
  • 26. FeliCaの使い方提案 IDとして セキュリティを必要としないならばIDm 携帯電話とのインターフェース 送信できるデータ量は少ないが、サーバー連携でできることが増えそ う Tag 不特定多数に配布してサイト誘導 FeliCa Plug組み込み機器とのインターフェース 健康器具の履歴をオンライン管理 玩具を使ったソーシャルアプリ © 2009 Sony Corporation
  • 27. 開発上の注意 エラー処理について エラー時に発生するイベントに対するリスナを登録し、エラー時の処理を適切に 行ってください。エラー要因としては以下のようなものがあります。 FeliCa Proxy Service が起動していない リーダー/ライタが接続されていない、正しく認識されていない 必要なソフトウェアがインストールされていない (FeliCa Port Software) カードがかざされていない 通信エラー 連続してリクエストを送信しない 複数のリクエストを送信する場合には、 リクエストはキューされません 非同期イベントの到着を待って、次のリクエストを送信してください © 2009 Sony Corporation
  • 28. © 2009 Sony Corporation