Fitbit OS コマンドラインツールを使う
Fitbit OS コマンドラインツールを使う
0.概要
Fitbit Versaは、Javacriptなどのプログラムが組み込める機能があり、 Fitbit_Studioというweb上での開発ツールがあるが、ローカルでプログラムが組めるコマンドラインツールも用意されている。
本メモは、それについて記する。参照URLで説明されているものを日本語で簡単に説明したものになる。
1.インストールと新規アプリ作成
# エディターとして、Microsoft VSCodeを使うのであれば
以下のURLから必要なバイナリー(ubuntuなら.deb)をダウンロードして
インストールする。コマンド名としては、codeになる。
# Node.js 8.xi以上が必要となるので以下のようにnodeのバージョンを確認する。
node -v
v10.11.0
# 作業用のディレクトリを作る
mkdir FitbitWS
cd FitbitWS/
#以下のコマンドでアプリのテンプレート(my-app)を作成する:
npx create-fitbit-app my-app
以下のように色々な質問が来るので適切に応える:
? What type of application should be created? clockface
? What should the name of this application be? cli-cf01
? Should this application contain a companion component? Yes
? Should this application contain a settings component? Yes
? Which platforms should this application be built for? (Press
# ここで、実機(versa)と実機とペアリングしたスマフォ(iPhone)のBrigeを有効にするか
# Fitbit OS Simulatorを起動する。(Simulatorは同一PCでなくても良い)
npx bitbit
# ここで、fitbitのアカウントにログインすることになるので
# 聞かれたら、IDとパスワードを入力する
fitbit$ build
fitbit$ install
# ここで自動的にスマフォとversa(またはシミュレータ)に接続され
# ビルドしたプログラムがインストールされる。
# 実機にとシミュレータが同時に動作している場合、どちらにするか聞かれるので選択する。
# 以下のコマンドで、こちらから接続することもできる。
connect device
connect phone
# ここでは以下のコマンドが使用できる:
help [command...] Provides help for a given command.
exit Exits application.
build Build application
connect device Connect a device
connect phone Connect a phone
install [packagePath] Install an app package
screenshot [path] Capture a screenshot from the connected device
logout Log out of your Fitbit account
2.既存アプリのアップデート
(1)まずは、Fitbit Studioにあるアプリをエクスポート(ダウンロード)する。zip形式なので解凍(unzip)する。
(2)package.json修正
package.jsonの一部を以下のように修正する:
"devDependencies": {
"@fitbit/sdk": "~2.0.0",
"@fitbit/sdk-cli": "^1.0.0"
},
(3)以下を実行する:
npm install
(4)ここからは新規アプリの場合と同様に以下を実行する:
npx fitbit
build
connect device
connect phone
install
3.参照URL
https://dev.fitbit.com/blog/2018-08-23-cli-tools/#highway-to-shell
By Your Command! Meet the Command Line Interface
以上
| 固定リンク
「脈拍計付き活動量計」カテゴリの記事
- HR sensor Logger(2019.11.24)
- Web-BluetoothでHRセンサーを接続する(2019.11.10)
- Polar Ignite 使用メモ(2019.09.16)
- TCXcsvGraph(2019.09.16)
- readTCX(TCX-to-CSV)(2019.08.31)
「linux」カテゴリの記事
- platfomioを使ってnaitive(linux/windows)のプログラムをビルドする方法(2021.03.10)
- micro:bit Yotta開発ツール(linux版)(2021.01.09)
- PlatformIOをRaspberryPi4で動かしてみる(実験)(2020.10.20)
- headless RaspberryPiインストール方法(v2)(2020.10.20)
- wio-terminalのファームウェア・アップデートについて(linux版)(2020.10.15)
コメント