Design and Implementation of a Bluetooth Ad Hoc Network for Indoor Positioning