package com.sinognss.gnss.demo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.sinognss.gnss.demo.databinding.ActivityGnssLocationBinding

/**
 * @author: zhangchao
 * @date: 2026/7/1
 * @description:
 */
class AidlDemoActivity : AppCompatActivity() {

    private lateinit var gnssAidlClient: GnssAidlClient

    lateinit var binding: ActivityGnssLocationBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityGnssLocationBinding.inflate(layoutInflater)
        setContentView(binding.root)

        gnssAidlClient = GnssAidlClient(this)
        gnssAidlClient.bindAidlService()
        gnssAidlClient.onLocation = {
            runOnUiThread {
                binding.tvLocation.setText(it.toString())
            }
        }
        gnssAidlClient.onNmea = {
            runOnUiThread {
                binding.tvNmea.setText(it.toString())
            }
        }

    }

    override fun onDestroy() {
        super.onDestroy()
        gnssAidlClient.unbindAidlService()
    }
}
