<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23915/how-to-update-ble-device-name-in-ios-swift</link><description>I would like to update ble device name from device1 to user2.
How i can do this in swift language . i m atrung to update by ios app. 
 is below way is right? but not able to update 
 let hexData = &amp;quot;user2&amp;quot;?.dataFromHexString() 
 peripheral.writeValue</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Aug 2017 08:49:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23915/how-to-update-ble-device-name-in-ios-swift" /><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94128?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 08:49:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d31b53f-589b-4922-88bd-64dc75a8c45c</guid><dc:creator>Vijyendra</dc:creator><description>&lt;p&gt;Thanks All,&lt;/p&gt;
&lt;p&gt;Successfully updated device name, aplha value and date on ble device...just was missing sequence :(&lt;/p&gt;
&lt;p&gt;Below is the code: for future reference&lt;/p&gt;
&lt;p&gt;@IBAction func updateDevicePressed(){&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    self.showActivityView()
    self.updateButton.isEnabled = false
    
    DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
        self.updateRegistrationNumber()
    }
}

func updateRegistrationNumber(){
    
    let hexValReg = deviceName.unicodeScalars.filter { $0.isASCII }.map { String(format: &amp;quot;%X&amp;quot;, $0.value) }.joined()
    print(hexValReg)
    let regData = self.dataWithHexString(hex: hexValReg)// 50756E65 pune
    
    deviceNameCharacterToUpdate?.service.peripheral.writeValue(regData as Data, for: deviceNameCharacterToUpdate!, type: CBCharacteristicWriteType.withResponse)
    
    DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
        self.updateLocation()
    } 
}

func updateLocation(){
    
    let hex = location.unicodeScalars.filter { $0.isASCII }.map { String(format: &amp;quot;%X&amp;quot;, $0.value) }.joined()
    let dataLoca = self.dataWithHexString(hex: hex)

    locationCharacterToUpdate?.service.peripheral.writeValue(dataLoca as Data, for: locationCharacterToUpdate!, type: CBCharacteristicWriteType.withResponse)
  
    DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
        self.updateExpireDate()
    }
}

func updateExpireDate(){
    
    let data = self.dataWithHexString(hex: hexDateToWrite)// 5976C3A3
    dateCharacterToUpdate?.service.peripheral.writeValue(data, for: dateCharacterToUpdate!, type: CBCharacteristicWriteType.withResponse)

          self.updateButton.isEnabled = true
          self.hideActivityView()

}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94127?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 07:42:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0534558f-47a4-470c-adda-ff43860ecac9</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;If you are trying to update the Bluetooth low energy Generic Access Profile (GAP) device name. This property declaration is &lt;code&gt;var name: String? { get }&lt;/code&gt; I&amp;#39;m not to familiar with swift, but since it says &lt;em&gt;get&lt;/em&gt;, I assume you cannot &lt;em&gt;set&lt;/em&gt; it. Also for objective C this is read only. So you need to create a characteristic on the peripheral and use this to update the name. On Android I belive you can write to the GAP device name directly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94126?ContentTypeID=1</link><pubDate>Sun, 30 Jul 2017 22:30:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59748f8b-f09f-4d7f-8ee9-35927ab672aa</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;@RK&lt;/p&gt;
&lt;p&gt;Yes. Its a terrible question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94125?ContentTypeID=1</link><pubDate>Sun, 30 Jul 2017 11:00:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba551ffe-e823-42cc-99a5-3f261e65baca</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;not really - he&amp;#39;s asking about swift syntax to do something. This isn&amp;#39;t a swift support forum. If he was asking about what characteristic one might write to to change the name then it would be a slightly more relevant question which could be answered.&lt;/p&gt;
&lt;p&gt;or put another way ... it&amp;#39;s not a terribly good question which leaves far too much unspecified like ... for instance ... what &amp;#39;characteristic&amp;#39; is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94123?ContentTypeID=1</link><pubDate>Sun, 30 Jul 2017 10:28:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2b90ba0-b750-4e5f-b0da-646d24ac906c</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;@Rk
This presumes that the target BLE device has a Write Characteristic which can be used to change the advertising name.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to update BLE device name in ios swift !</title><link>https://devzone.nordicsemi.com/thread/94124?ContentTypeID=1</link><pubDate>Sun, 30 Jul 2017 02:36:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ae5f3c2-1683-498d-9645-542f61d8bb70</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I think you&amp;#39;d be better off asking that in an Apple bluetooth or swift forum.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>