package Ġcom . be ep iz . b leg att coroutines . sample Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 4 . app . Fragment Activity Ċ import Ġcom . be ep iz . b leg att coroutines . sample . common . B le Scan He ater Ċ import Ġcom . be ep iz . b leg att coroutines . sample . common . Main ViewModel Ċ import Ġcom . be ep iz . b leg att coroutines . sample . common . extensions . activity Scope Ċ import Ġcom . be ep iz . b leg att coroutines . sample . common . register . register While Res umed Ċ import Ġkotlinx . android . synt hetic . main . activity _ main .* Ċ import Ġsplit ties . views . onClick Ċ Ċ class ĠMainActivity Ġ: ĠFragment Activity () Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby Ġactivity Scope < Main ViewModel >() ĊĠĠĠ Ġprivate Ġval Ġble Scan He ater Ġ= ĠB le Scan He ater () ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġbtn _ log _ ble _ device _ name . onClick Ġ{ ĠviewModel . log Name And Appearance () Ġ} ĊĠĠĠĠĠĠĠ Ġregister While Res umed ( ble Scan He ater ) ĊĠĠĠ Ġ} Ċ } Ċ