add motion sensor API and test code