add battery API and test code