I am trying to achieve the same thing, however I don't get as far as you get.
Keep getting "The specified UUID is not allowed for this operation." on adding the Battery and HID services.
Could you please let me know how you got passed that?
I too would like to know why the GATT HID service is not allowed when acting as a peripheral.
By trial and error I have found the following to be forbidden:
- Generic Access
- Battery Service
- Bond Management Service
- Current Time Service
- Device Information
- Generic Attribute
- Human Interface Device
Where is the documentation stating these are not supported and the reasons behind it? Having an iPad or iPhone work as a HID device would be a great accessibility feature opening up many possibilities.