Skip to content

Instantly share code, notes, and snippets.

@paulw11
Created December 22, 2018 05:01
Show Gist options
  • Save paulw11/971d97b0d07ac6ea0888bebaac1390b9 to your computer and use it in GitHub Desktop.
Save paulw11/971d97b0d07ac6ea0888bebaac1390b9 to your computer and use it in GitHub Desktop.
func doSetup(){
service = CBMutableService(type: CBUUID(string: "00001000-0000-1000-8000-00805F9B34FB"), primary: true)
characteristic = CBMutableCharacteristic(type: CBUUID(string: "00001001-0000-1000-8000-00805F9B34FB"), properties: [CBCharacteristicProperties.read, CBCharacteristicProperties.write, CBCharacteristicProperties.notify], value: nil, permissions: [CBAttributePermissions.readable, CBAttributePermissions.writeable])
service?.characteristics = [characteristic!]
peripheralManager?.add(service!)
}
func startAdvertising {
peripheralManager?.startAdvertising([CBAdvertisementDataLocalNameKey: UIDevice.current.name, CBAdvertisementDataServiceUUIDsKey: [CBUUID(string: "00001000-0000-1000-8000-00805F9B34FB")]])
NSLog("Started advertising")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment