I'm guessing that you have a wiimote plus. I had absolutely hideous times trying to make it work right.
There are a lot of already established tools to help you, but the two most important parts are the toshiba bluetooth stack and a program called TouchMote... at least I think that's what program it was.
What operating system are you trying to do all this with?