func GapService()

in nmxact/nmble/ble_util.go [636:692]


func GapService(devName string) BleSvc {
	return BleSvc{
		Uuid:    BleUuid{0x1800, [16]byte{}},
		SvcType: BLE_SVC_TYPE_PRIMARY,
		Chrs: []BleChr{
			// Device name.
			BleChr{
				Uuid:       BleUuid{0x2a00, [16]byte{}},
				Flags:      BLE_GATT_F_READ,
				MinKeySize: 0,
				AccessCb: func(access BleGattAccess) (uint8, []byte) {
					return 0, []byte(devName)
				},
			},

			// Appearance.
			BleChr{
				Uuid:       BleUuid{0x2a01, [16]byte{}},
				Flags:      BLE_GATT_F_READ,
				MinKeySize: 0,
				AccessCb: func(access BleGattAccess) (uint8, []byte) {
					return 0, []byte{0, 0}
				},
			},

			// Peripheral privacy flag.
			BleChr{
				Uuid:       BleUuid{0x2a02, [16]byte{}},
				Flags:      BLE_GATT_F_READ,
				MinKeySize: 0,
				AccessCb: func(access BleGattAccess) (uint8, []byte) {
					return 0, []byte{0}
				},
			},

			// Reconnection address.
			BleChr{
				Uuid:       BleUuid{0x2a03, [16]byte{}},
				Flags:      BLE_GATT_F_READ,
				MinKeySize: 0,
				AccessCb: func(access BleGattAccess) (uint8, []byte) {
					return 0, []byte{0, 0, 0, 0, 0, 0}
				},
			},

			// Peripheral preferred connection parameters.
			BleChr{
				Uuid:       BleUuid{0x2a04, [16]byte{}},
				Flags:      BLE_GATT_F_READ,
				MinKeySize: 0,
				AccessCb: func(access BleGattAccess) (uint8, []byte) {
					return 0, []byte{0, 0, 0, 0, 0, 0, 0, 0}
				},
			},
		},
	}
}