This is the reason no connection is made. menuitem is referred to but is not defined - the code silently bombs before making the bluetooth connection.