SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
仕事
個人活動
http://tanaka733.net
https://www.nuget.org/profiles/tanaka_733/
https://github.com/tanaka-takayoshi
3か月に1回程度の勉強会中心のコミュニティ
めと #とは
iPhoneやiPadで使えるドン!可愛さと実用性を兼ね備えた
『太鼓の達人』専用Bluetoothコントローラ「太鼓とバチ」12月発売
なんでBluetooth?
マスター・スレイブ通信
リンク層プロトコル
ペアリング
プロファイル
サービスディスカバリ
BR/EDR (RFCOMM)
Bluetooth LTE (GATT)
詳細はブログに書いています
Texas Instrument
Bluetooth Low Energy(CC2541)SensorTag
温度センサ
湿度センサ
圧力センサ
加速度計
ジャイロスコープ
磁力計
RFCOMM Scenario: Send File as a Client(XAML)
RFCOMM Scenario: Receive File as a Server(XAML)
GATT Scenario: Retrieve Bluetooth LE Data(XAML)
GATT Scenario: Control a Bluetooth LE Thermometer Device(XAML)
Bluetooth for Windows Phone 8
【連載】Bluetooth LE (1) Bluetooth Low Energy の基礎
Bluetooth SMART デバイス(LE GATT Profile)と連携するWindows
Store Appsの開発
http://code.msdn.microsoft.com/windowsapps/Bluetooth-Rfcomm-Chat-
afcee559/view/Discussions#content
http://code.msdn.microsoft.com/windowsapps/Bluetooth-Generic-5a99ef95/
http://blogs.msdn.com/b/flecoqui/archive/2013/12/13/windows-store-and-
windows-phone-app-to-app-communication-over-bluetooth.aspx
http://msdn.microsoft.com/ja-jp/library/windows/apps/dn263090.aspx
<Capabilities>
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="serviceId:BEFB3B5F-C81D-48BB-8136-72E6BC3D0169"/>
</m2:Device>
</m2:DeviceCapability>
<m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
<m2:Device Id="any">
<m2:Function Type="serviceId:f000aa00-0451-4000-b000-000000000000" />
<m2:Function Type="serviceId:f000aa10-0451-4000-b000-000000000000" />
</m2:Device>
</m2:DeviceCapability>
</Capabilities>
<Capabilities>
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="serviceId:BEFB3B5F-C81D-48BB-8136-72E6BC3D0169"/>
</m2:Device>
</m2:DeviceCapability>
<m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
<m2:Device Id="any">
<m2:Function Type="serviceId:f000aa00-0451-4000-b000-000000000000" />
<m2:Function Type="serviceId:f000aa10-0451-4000-b000-000000000000" />
</m2:Device>
</m2:DeviceCapability>
</Capabilities>
https://github.com/tanaka-
takayoshi/BluetoothRfcommUniversalApp
//appxmanifet で指定したServiceUUIDを使う
rfcommProvider = await RfcommServiceProvider.CreateAsync(
RfcommServiceId.FromUuid(BluetoothServiceUuid));
//Socket作成して、Clientからの接続を待機
socketListener = new StreamSocketListener();
socketListener.ConnectionReceived += OnConnectionReceived;
await socketListener.BindServiceNameAsync(rfcommProvider.ServiceId.AsString(),
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);
//SDPに設定する部分は略
//Advertising開始
rfcommProvider.StartAdvertising(socketListener);
//ペアリングされている端末を検出
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var Peers = await PeerFinder.FindAllPeersAsync();
//検出した端末から1台選択
var device =
(await BluetoothRfcommClient.GetListPairedDevices()).First();
socket = new StreamSocket();
await socket.ConnectAsync(
new HostName(device.HostName), BluetoothServiceName);
//Advertising停止
PeerFinder.Stop();
writer = new DataWriter(socket.OutputStream);
//送信するバイトの長さ+byte配列を書きこみ
writer.WriteUInt32((uint)Command.CommandLength);
writer.WriteBytes(Command.CommandBytes);
await writer.StoreAsync();
Bluetooth SMART デバイス(LE GATT Profile)と連携する
Windows Store Appsの開発
https://github.com/tanaka-takayoshi/TISensor.Rx
//SensorごとのUUIDを指定して端末を検出する
var selector = GattDeviceService.GetDeviceSelectorFromUuid(
new Guid(sensorServiceUuid));
var devices = await DeviceInformation.FindAllAsync(selector);
var device = devices.First();
//ID指定でサービスを作成
deviceService = await GattDeviceService.FromIdAsync(deviceInfo.Id);
//センサーを有効化 (センサーによっては書きこむ値が違う)
var configCharacteristic = deviceService.GetCharacteristics(
new Guid(sensorConfigUuid)).First();
await configCharacteristic.WriteValueAsync(new byte[] {1}.AsBuffer());
dataCharacteristic = deviceService.GetCharacteristics(
new Guid(sensorDataUuid)).First();
await dataCharacteristic.
WriteClientCharacteristicConfigurationDescriptorAsync(
GattClientCharacteristicConfigurationDescriptorValue.Notify);
dataCharacteristic.ValueChanged += (sender, args) =>
{
ReadRawData(args);
};
public IObservable<SensorRawValue> StartMonitor()
{
return
Observable.FromEventPattern<
TypedEventHandler<GattCharacteristic,
GattValueChangedEventArgs>,
GattValueChangedEventArgs>(
h => dataCharacteristic.ValueChanged += h,
h => dataCharacteristic.ValueChanged -= h)
.Select(p => ReadRawData(p.EventArgs));
}
using
20140802 Bluetooth を使って Universall App で大連携

Más contenido relacionado

Similar a 20140802 Bluetooth を使って Universall App で大連携

20130902 btleハンズオンワークショップ
20130902 btleハンズオンワークショップ20130902 btleハンズオンワークショップ
20130902 btleハンズオンワークショップ
akihiro uehara
 
システムと情報の数理・ネットワーク概論
システムと情報の数理・ネットワーク概論システムと情報の数理・ネットワーク概論
システムと情報の数理・ネットワーク概論
shigaoki
 

Similar a 20140802 Bluetooth を使って Universall App で大連携 (20)

Packetbeatの基礎から、IoTデバイス異常検知への応用まで
Packetbeatの基礎から、IoTデバイス異常検知への応用までPacketbeatの基礎から、IoTデバイス異常検知への応用まで
Packetbeatの基礎から、IoTデバイス異常検知への応用まで
 
WebBluetoothなど - JSで制御するBluetoothと基板の勉強会 -
WebBluetoothなど	- JSで制御するBluetoothと基板の勉強会 -WebBluetoothなど	- JSで制御するBluetoothと基板の勉強会 -
WebBluetoothなど - JSで制御するBluetoothと基板の勉強会 -
 
20130902 btleハンズオンワークショップ
20130902 btleハンズオンワークショップ20130902 btleハンズオンワークショップ
20130902 btleハンズオンワークショップ
 
Sniffing BitTorrent DHT ~人はBTで何を落とすのか~
Sniffing BitTorrent DHT ~人はBTで何を落とすのか~Sniffing BitTorrent DHT ~人はBTで何を落とすのか~
Sniffing BitTorrent DHT ~人はBTで何を落とすのか~
 
JAWS DAYS 2018 | IoT時代におけるデバイスのファームウェアとクラウドのいい関係
JAWS DAYS 2018 | IoT時代におけるデバイスのファームウェアとクラウドのいい関係JAWS DAYS 2018 | IoT時代におけるデバイスのファームウェアとクラウドのいい関係
JAWS DAYS 2018 | IoT時代におけるデバイスのファームウェアとクラウドのいい関係
 
[15分勉強会] Bluetooth 4.2 → 5 でなにが変わったか?
[15分勉強会] Bluetooth 4.2 → 5 でなにが変わったか?[15分勉強会] Bluetooth 4.2 → 5 でなにが変わったか?
[15分勉強会] Bluetooth 4.2 → 5 でなにが変わったか?
 
システムと情報の数理・ネットワーク概論
システムと情報の数理・ネットワーク概論システムと情報の数理・ネットワーク概論
システムと情報の数理・ネットワーク概論
 
Getting Started with Graph Database with Python
Getting Started with Graph Database with PythonGetting Started with Graph Database with Python
Getting Started with Graph Database with Python
 
JAWS-UG 金沢 | これだけ知っていれば LPWA
JAWS-UG 金沢 | これだけ知っていれば LPWAJAWS-UG 金沢 | これだけ知っていれば LPWA
JAWS-UG 金沢 | これだけ知っていれば LPWA
 
Rubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつりRubyで創るOpenFlowネットワーク - LLまつり
Rubyで創るOpenFlowネットワーク - LLまつり
 
SensorBee: Stream Processing Engine in IoT
SensorBee: Stream Processing Engine in IoTSensorBee: Stream Processing Engine in IoT
SensorBee: Stream Processing Engine in IoT
 
YAPC::Asia2014 - O2O/IoT/Wearable時代におけるWeb以外のネットワーク技術入門
YAPC::Asia2014 - O2O/IoT/Wearable時代におけるWeb以外のネットワーク技術入門YAPC::Asia2014 - O2O/IoT/Wearable時代におけるWeb以外のネットワーク技術入門
YAPC::Asia2014 - O2O/IoT/Wearable時代におけるWeb以外のネットワーク技術入門
 
SigfoxではじめるIoT勉強会
SigfoxではじめるIoT勉強会SigfoxではじめるIoT勉強会
SigfoxではじめるIoT勉強会
 
Ppt fukui g
Ppt fukui gPpt fukui g
Ppt fukui g
 
SORACOM Conference Discovery 2017 | E2. IoTデバイス・デザインパターン ベストプラクティス
SORACOM Conference Discovery 2017 | E2. IoTデバイス・デザインパターン ベストプラクティスSORACOM Conference Discovery 2017 | E2. IoTデバイス・デザインパターン ベストプラクティス
SORACOM Conference Discovery 2017 | E2. IoTデバイス・デザインパターン ベストプラクティス
 
SORACOM UG 信州 #3 | About SORACOM & Updates
SORACOM UG 信州 #3 | About SORACOM & UpdatesSORACOM UG 信州 #3 | About SORACOM & Updates
SORACOM UG 信州 #3 | About SORACOM & Updates
 
第三回IoT関連技術勉強会 データ通信編
第三回IoT関連技術勉強会 データ通信編第三回IoT関連技術勉強会 データ通信編
第三回IoT関連技術勉強会 データ通信編
 
IoTを支える(かもしれない)技術
IoTを支える(かもしれない)技術IoTを支える(かもしれない)技術
IoTを支える(かもしれない)技術
 
ゲームの通信をつくる仕事はどうなるのだろう?
ゲームの通信をつくる仕事はどうなるのだろう?ゲームの通信をつくる仕事はどうなるのだろう?
ゲームの通信をつくる仕事はどうなるのだろう?
 
20120525 mt websocket
20120525 mt websocket20120525 mt websocket
20120525 mt websocket
 

Más de Takayoshi Tanaka

.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
Takayoshi Tanaka
 

Más de Takayoshi Tanaka (20)

deep dive distributed tracing
deep dive distributed tracingdeep dive distributed tracing
deep dive distributed tracing
 
202202 open telemetry .net handson
202202 open telemetry .net handson202202 open telemetry .net handson
202202 open telemetry .net handson
 
202109-New_Relic-for-csharp-engineers
202109-New_Relic-for-csharp-engineers202109-New_Relic-for-csharp-engineers
202109-New_Relic-for-csharp-engineers
 
20210129 azure webapplogging
20210129 azure webapplogging20210129 azure webapplogging
20210129 azure webapplogging
 
20201127 .NET 5
20201127 .NET 520201127 .NET 5
20201127 .NET 5
 
Unity(再)入門
Unity(再)入門Unity(再)入門
Unity(再)入門
 
最近のQ#について
最近のQ#について最近のQ#について
最近のQ#について
 
SRENEXT 2020 [B5] New RelicのSREに学ぶ SREのためのNew Relic活用法
SRENEXT 2020 [B5] New RelicのSREに学ぶSREのためのNew Relic活用法SRENEXT 2020 [B5] New RelicのSREに学ぶSREのためのNew Relic活用法
SRENEXT 2020 [B5] New RelicのSREに学ぶ SREのためのNew Relic活用法
 
20191024 Get Start gRPC with ASP.NET
20191024 Get Start gRPC with ASP.NET20191024 Get Start gRPC with ASP.NET
20191024 Get Start gRPC with ASP.NET
 
New Relicで始める、.NET Applications on AWSのObservability
New Relicで始める、.NET Applications on AWSのObservabilityNew Relicで始める、.NET Applications on AWSのObservability
New Relicで始める、.NET Applications on AWSのObservability
 
C#エンジニアのためのdocker kubernetesハンズオン (再)
C#エンジニアのためのdocker kubernetesハンズオン (再)C#エンジニアのためのdocker kubernetesハンズオン (再)
C#エンジニアのためのdocker kubernetesハンズオン (再)
 
20190806 Q# Measurements
20190806 Q# Measurements20190806 Q# Measurements
20190806 Q# Measurements
 
C#エンジニアのためのdocker kubernetesハンズオン
C#エンジニアのためのdocker kubernetesハンズオンC#エンジニアのためのdocker kubernetesハンズオン
C#エンジニアのためのdocker kubernetesハンズオン
 
20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...
 
.NET Core向けコンテナおよびデバッグ関連のVisual Studio 2019の機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studio 2019の機能.NET Core向けコンテナおよびデバッグ関連のVisual Studio 2019の機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studio 2019の機能
 
.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
.NET Core向けコンテナおよびデバッグ関連のVisual Studioの新機能
 
Try! Visual Studio 209 git feature
Try! Visual Studio 209 git featureTry! Visual Studio 209 git feature
Try! Visual Studio 209 git feature
 
Q#基礎 ver1.1
Q#基礎 ver1.1Q#基礎 ver1.1
Q#基礎 ver1.1
 
(過去バージョン) Q#基礎 ver1.0
(過去バージョン) Q#基礎 ver1.0(過去バージョン) Q#基礎 ver1.0
(過去バージョン) Q#基礎 ver1.0
 
ゼロから始めるQ#
ゼロから始めるQ#ゼロから始めるQ#
ゼロから始めるQ#
 

Último

Último (12)

Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 

20140802 Bluetooth を使って Universall App で大連携