ble nano hid over gatt

Dependencies:   BLE_API mbed-dev nRF51822

Revision:
16:345eebc4f259
Parent:
15:70bf079d3ee1
Child:
17:3233ee19f716
--- a/HIDController_BLE.cpp	Mon Aug 22 02:29:37 2016 +0000
+++ b/HIDController_BLE.cpp	Mon Aug 22 12:28:47 2016 +0000
@@ -124,7 +124,22 @@
 	// https://developer.mbed.org/compiler/#nav:/keyboard/BLE_API/ble/blecommon.h;
 	ble_error_t error;
 	BLE &ble          = params->ble;
-	
+
+	/**< Minimum Connection Interval in 1.25 ms units, see BLE_GAP_CP_LIMITS.*/
+    uint16_t minConnectionInterval = Gap::MSEC_TO_GAP_DURATION_UNITS(12);
+    /**< Maximum Connection Interval in 1.25 ms units, see BLE_GAP_CP_LIMITS.*/
+    uint16_t maxConnectionInterval = Gap::MSEC_TO_GAP_DURATION_UNITS(22);
+    /**< Slave Latency in number of connection events, see BLE_GAP_CP_LIMITS.*/
+    uint16_t slaveLatency = 0;               
+    /**< Connection Supervision Timeout in 10 ms units, see BLE_GAP_CP_LIMITS.*/ 
+    uint16_t connectionSupervisionTimeout = 32 * 100;
+    Gap::ConnectionParams_t connectionParams = {
+    	minConnectionInterval,
+    	maxConnectionInterval,
+    	slaveLatency,
+    	connectionSupervisionTimeout
+    };
+    	
 	error = params->error;
 	if (error != BLE_ERROR_NONE) {
 		printf("error on ble.init() \r\n");
@@ -145,12 +160,24 @@
 		printf("error on ble.securityManager().init()");
 		goto return_error;
 	}
+	
 
+	printf("new KeyboardService\r\n");
 	keyboardService = new KeyboardService(ble);
+	printf("new DeviceInformationService\r\n");
 	deviceInformationService = new DeviceInformationService(ble, "lowreal.net", MODEL_NAME, SERIAL_NUMBER, HARDWARE_REVISION, FIRMWARE_REVISION, SOFTWARE_REVISION);
+	printf("new BatteryService\r\n");
 	batteryService = new BatteryService(ble, 100);
+	/** TODO STUCK with BLE NANO
+	printf("new DFUService\r\n");
+	dfuService = new DFUService(ble);
+	*/
+	
 	updateBatteryLevel();
-	dfuService = new DFUService(ble, NULL);
+
+	printf("setup connection params\r\n");
+
+    ble.gap().setPreferredConnectionParams(&connectionParams);
 
 	printf("general setup\r\n");
 	error = ble.gap().accumulateAdvertisingPayload(