package com.example.blu.toys.activity;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;

import androidx.annotation.RequiresApi;

import com.clj.fastble.data.BleDevice;
import com.example.blu.toys.R;
import com.example.blu.toys.ble.BlePlay;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class SearchingActivity extends BaseActivity {


	@Override
	public int getLayout() {
		return R.layout.activity_searching;
	}

	@Override
	public void init(Bundle savedInstanceState) {
		EventBus.getDefault().register(this);
	}

	@Override
	public void initData() {
		BlePlay.getInstance().scanBle();
	}


	@RequiresApi(api = Build.VERSION_CODES.N)
	@Subscribe(threadMode = ThreadMode.MAIN)
	public void GoDeviceListPage(List<BleDevice> bleDevices) {
		goActivity(SelectDeviceActivity.class);
	}

	@OnClick(R.id.back_but)
	public void onViewClicked() {
		finish();
	}
}