Windows Mobileからのお手軽デバイス利用術

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Windows Mobileからのお手軽デバイス利用術 - Presentation Transcript

    1. Windows Mobile からの お手軽デバイス利用術 CH3COOH( 酢酸 )
    2. 自己紹介
      • CH3COOH( 酢酸 ) です
      • 携帯電話用のアプリ開発に携わった後、 現在は、業務系システムを VB.NET で開発しています
      • プライベートで、 Windows Mobile 向けの アプリを開発しています ( あまり公開していませんが…… )
    3. Windows Mobileとは
      • Windows CE をベースにした PDA 向けのプラットフォーム
      • 国内では、 WILLCOM の W-ZERO3 シリーズを始めとして、「スマートフォン」と呼ばれる分野で採用されています
      • 先日開催された TechEd US のセッションでは、 最新バージョンの「 Windows Mobile 6.5 」の話が中心でした。
    4. Windows Mobile 端末に 搭載されているデバイスの例
      • カメラ
      • GPS
      • BlueTooth
      • 赤外線
      • 無線 LAN
      • 加速度センサ
      • バイブレータ
    5. .NET Compact Framework で サポートされているデバイス
      • カメラ
      • GPS
      • BlueTooth
      • 赤外線
      • 無線 LAN
      • 加速度センサ
      • バイブレータ
    6. .NET Compact Framework からの デバイスの利用例
      • .NET Compact Framework で、 未サポートのデバイスを使用するには、 Win32API を P/Invoke で呼び出します
      • ここではバイブレーションを使用する為の P/Invoke と OpenNETCF を使ったサンプルコードをご紹介します
    7. P/Invoke を使った 長~~~いコード (1)
      • LED とバイブレータを制御する NLedAPI を呼び出すために P/Invoke の定義を行います
      • Public Class Led
      • <DllImport(&quot;coredll.dll&quot;, SetLastError:=True)> _
      • Private Shared Function NLedGetDeviceInfo(ByVal h As UInteger, _
      • ByRef pOutput As NLED_COUNT_INFO) As Boolean
      • End Function
      • <DllImport(&quot;coredll.dll&quot;, SetLastError:=True)> _
      • Private Shared Function NLedSetDevice(ByVal h As UInteger, _
      • ByRef pOutput As NLED_SETTINGS_INFO) As Boolean
      • End Function
      • Private Const NLED_COUNT_INFO_ID As UInteger = 0
      • Private Const NLED_SETTINGS_INFO_ID As UInteger = 2
    8. P/Invoke を使った 長~~~いコード (2)
      • NLedAPI に渡す構造体の定義を行います
      • Private Structure NLED_SETTINGS_INFO
      • Public LedNum As UInteger
      • Public OffOnBlink As Integer
      • Public TotalCycleTime As Long
      • Public OnTime As Long
      • Public OffTime As Long
      • Public MetaCycleOn As Integer
      • Public MetaCycleOff As Integer
      • End Structure
      • Private Structure NLED_COUNT_INFO
      • Public cLeds As UInteger
      • End Structure
    9. P/Invoke を使った 長~~~いコード (3)
      • Public Shared Function GetLedCount() As Integer
      • Dim info As New NLED_COUNT_INFO()
      • Dim LEDCount As Integer = 0
      • If NLedGetDeviceInfo(NLED_COUNT_INFO_ID, info) Then
      • LEDCount = CInt(info.cLeds)
      • End If
      • Return LEDCount
      • End Function
      • Public Shared Sub SetLedStatus(ByVal ledID As Integer, _
      • ByVal status As Integer)
      • Dim info As New NLED_SETTINGS_INFO()
      • With info
      • .LedNum = System.Convert.ToUInt32(ledID)
      • .OffOnBlink = System.Convert.ToUInt16(status)
      • End With
      • NLedSetDevice(NLED_SETTINGS_INFO_ID, info)
      • End Sub
      • End Class
    10. P/Invoke を使った 長~~~いコード (4)
      • バイブレーションをさせる為のクラスを定義しましたので、実際にバイブをさせる処理です
      •   Private Sub Button2_Click(ByVal sender As System.Object, _
      • ByVal e As System.EventArgs) _
      • Handles Button2.Click
      • ' バイブレーション開始
      • LedVibrate.SetLedStatus(1, 1)
      • ' 2 秒間鳴動させた後、バイブを停止する
      • System.Threading.Thread.Sleep(2000)
      • LedVibrate.SetLedStatus(1, 0)
      • End Sub
    11. OpenNETCF を使った 短くシンプルなコード
      • OpenNETCF.WindowsCE.dll を参照して、 実際にバイブをさせる処理です
      •    Private Sub Button1_Click(ByVal sender As System.Object, _
      • ByVal e As System.EventArgs) _
      • Handles Button1.Click
      • ' バイブレーション開始
      • Dim led As New OpenNETCF.WindowsCE.Notification.Led()
      • led.SetLedStatus(1, OpenNETCF.WindowsCE.Notification.Led.LedState.On)
      • ' 2 秒間鳴動させた後、バイブを停止する
      • System.Threading.Thread.Sleep(2000)
      • led.SetLedStatus(1, OpenNETCF.WindowsCE.Notification.Led.LedState.Off)
      • End Sub
    12. OpenNETCF とは
      • .NET Compact FrameworkからWindows Mobileを使いやすくする為のシェアソースのクラスライブラリ
      • コードをそのままでなければ販売出来るし、公開義務も発生しないので一部を取り込んで利用も出来ます(ライセンスに気をつけてください)
    13. デバイスを活用した ソリューションの提案
      • GPS を使った営業支援システム
        • GPS ロガーで経路を記録して、 そのまま営業日報として配信
      • カメラを使った出張買取サービス
        • 車の出張買取サービスで査定情報の入力や キズなどを撮影したデータを本部に配信
    14. まとめ
      • 手間の掛かるデバイス制御の部分に OpenNETCF を使うことで、 本質の部分にリソースを投入する事が 出来るのではないでしょうか?
    15. 最後に
      • Windows Mobile CF プログラミング Tips
        • http://ch3cooh.jp/tips/wm/
        • CF のサンプルコードや P/Invoke を使ったデバイスの操作に関する Tips などを掲載しています
      • スマートフォン勉強会
        • http://smartphone.techtalk.jp/
        • スマートフォン全般の使い方や、アプリケーションの開発手法をみんなで学んでいく勉強会です
        • 大阪は奇数月、東京では偶数月に開催してます
      • ご清聴ありがとうございました
    SlideShare Zeitgeist 2009

    + ch3cooh 393ch3cooh 393 Nominate

    custom

    1185 views, 0 favs, 1 embeds more stats

    2009/05/29に開催予定だった Tech Fielders more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1185
      • 1151 on SlideShare
      • 34 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 8
    Most viewed embeds
    • 34 views on http://ch3cooh.jp

    more

    All embeds
    • 34 views on http://ch3cooh.jp

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?