Skip to content

Commit

Permalink
#5 Added Host Controller Local Name Reading / Writing methods
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Mar 26, 2018
1 parent 61c02b1 commit 6e886fc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Sources/HostControllerLocalName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,19 @@ import Foundation

public extension BluetoothHostControllerInterface {

func
func writeLocalName(_ newValue: String, timeout: Int = HCI.defaultTimeout) throws {

guard let command = HostControllerBasebandCommand.WriteLocalNameParameter(localName: newValue)
else { fatalError("") }

try deviceRequest(command, timeout: timeout)
}

func readLocalName(timeout: Int = HCI.defaultTimeout) throws -> String {

let value = try deviceRequest(HostControllerBasebandCommand.ReadLocalNameReturnParameter.self,
timeout: timeout)

return value.localName
}
}

0 comments on commit 6e886fc

Please sign in to comment.