You'll find example code on GitHub https://github.com/edent/BMW-i-Remote