Peripheral Class
Item Index
Methods
Properties
Methods
discoverCharacteristics
    
        - 
                    
                        params
- 
                    
                        [param.UUIDs]
Discovers the specified characteristic(s) of a service.
The result of this operation is returned via the discoveredCharacteristics event.
Parameters:
- 
                    
                        paramsObjectAn object with the following properties: - 
                                
                                    serviceService
 
- 
                                
                                    
- 
                    
                        [param.UUIDs]Array of Strings optionalAn array of UUID strings, representing the characteristic types to be discovered. If not specified all characteristics of the service will be discovered, which is considerably slower and not recommended. 
Returns:
discoverDescriptorsForCharacteristic
    
        - 
                    
                        characteristic
Discovers the descriptor(s) of a characteristic.
The result of this operation is returned via the Peripheral/discoveredDescriptorsForCharacteristics:event event.
Parameters:
- 
                    
                        characteristicCharacteristic
Returns:
discoverIncludedServices
    
        - 
                    
                        params
Discovers the specified included service(s) of a service.
The result of this operation is returned via the discoveredIncludedServices event.
Parameters:
- 
                    
                        paramsObjectAn object with the following properties: - 
                                
                                    serviceServiceA primary GATT service. 
- 
                                
                                    [serviceUUIDs]Array of Strings optionalAn array of UUID strings, representing the included service types to be discovered. If not specified, all included services will be discovered, which is considerably slower and not recommended. 
 
- 
                                
                                    
Returns:
discoverServices
    
        ()
    
    
        
            Void
        
    
    
    
    
    
    
    
    
    Discovers available service(s) on the peripheral.
The result of this operation is returned via the discoveredServices event.
Returns:
getAddress
    
        ()
    
    
        
            String
        
    
    
    
    
    
    
    
    
    Returns the address of the remote Bluetooth device.
Returns:
readRSSI
    
        ()
    
    
        
            Void
        
    
    
    
    
    
    
    
    
    Retrieves the current RSSI of the link.
The result of this operation is returned via the updatedRSSI event.
Returns:
readValueForCharacteristic
    
        - 
                    
                        characteristic
Reads the value of a characteristic.
The result of this operation is returned via the updatedValueForCharacteristic event.
Parameters:
- 
                    
                        characteristicCharacteristic
Returns:
readValueForDescriptor
    
        - 
                    
                        descriptor
Reads the value of a descriptor.
The result of this operation is returned via the updatedValueForDescriptor event.
Parameters:
- 
                    
                        descriptorDescriptor
Returns:
subscribeToCharacteristic
    
        - 
                    
                        characteristic
- 
                    
                        [descriptorUUID="00002902-0000-1000-8000-00805f9b34fb"]
- 
                    
                        [descriptorValue=ENABLE_NOTIFICATION_VALUE]
Enables notifications/indications for a characteristic.
Parameters:
- 
                    
                        characteristicCharacteristic
- 
                    
                        [descriptorUUID="00002902-0000-1000-8000-00805f9b34fb"]String optionalUUID of the configuration descriptor of the characteristic. The module will attempt to write descriptorValueto this descriptor. If you do not want the module to do this, set this parameter to an empty string.
- 
                    
                        [descriptorValue=ENABLE_NOTIFICATION_VALUE]TiBuffer optionalThe value to be written to the configuration descriptor. 
Returns:
unsubscribeFromCharacteristic
    
        - 
                    
                        characteristic
- 
                    
                        [descriptorUUID="00002902-0000-1000-8000-00805f9b34fb"]
- 
                    
                        [descriptorValue=DISABLE_NOTIFICATION_VALUE]
Disables notifications/indications for a characteristic.
Parameters:
- 
                    
                        characteristicCharacteristic
- 
                    
                        [descriptorUUID="00002902-0000-1000-8000-00805f9b34fb"]String optionalUUID of the configuration descriptor of the characteristic. The module will attempt to write descriptorValueto this descriptor. If you do not want the module to do this, set this parameter to an empty string.
- 
                    
                        [descriptorValue=DISABLE_NOTIFICATION_VALUE]TiBuffer optionalThe value to be written to the configuration descriptor. 
Returns:
writeValueForCharacteristic
    
        - 
                    
                        params
Writes a value to a characteristic.
The result of this operation is returned via the wroteValueForCharacteristic event.
Parameters:
- 
                    
                        paramsObjectAn object with the following properties: - 
                                
                                    characteristicCharacteristicThe characteristic to change. 
- 
                                
                                    dataTiBufferThe new value of the characteristic. 
- 
                                
                                    [type=CHARACTERISTIC_TYPE_WRITE_WITH_RESPONSE]Number optionaltype of write to be executed. See CHARACTERISTIC_TYPE_WRITE_WITH_RESPONSE and CHARACTERISTIC_TYPE_WRITE_WITHOUT_RESPONSE. 
 
- 
                                
                                    
Returns:
writeValueForDescriptor
    
        - 
                    
                        params
Writes the value of a descriptor.
The result of this operation is returned via the wroteValueForDescriptor event.
Parameters:
- 
                    
                        paramsObject- 
                                
                                    descriptorDescriptor
- 
                                
                                    dataTiBuffer
 
- 
                                
                                    
Returns:
Properties
address
    String
    
    
    
        read-only
    
    
    
    The address of the remote Bluetooth device.
isConnected
    Boolean
    
    
    
        read-only
    
    
    
    Whether or not the peripheral is currently connected.
name
    String
    
    
    
        read-only
    
    
    
    The name of the peripheral.
RSSI
    Number
    
    
    
        read-only
    
    
    
    While connected, the RSSI of the link in decibels. Note that you need to call the readRSSI method to update this value.
services
    Array of Service objects
    
    
    
        read-only
    
    
    
    A list of Service objects that have been discovered on the peripheral.
Events
discoveredCharacteristics
    
    
    
    
    
    
    This event returns the result of a call to the
discoverCharacteristics method. If the characteristic(s) were read successfully,
they can be retrieved via the service property's
characteristics property.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        serviceServiceThe service for which the characteristics were discovered. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
discoveredDescriptionForCharacteristics
    
    
    
    
    
    
    This event returns the result of a call to the discoverDescriptorsForCharacteristic method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        characteristicCharacteristic
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
discoveredIncludedServices
    
    
    
    
    
    
    This event returns the result of a call to the discoverIncludedServices method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
discoveredServices
    
    
    
    
    
    
    This event returns the result of a call to the discoverServices method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
- 
                    
                        errorDescriptionStringThe error description; only present if an error occurred. 
updatedNotificationStateForCharacteristics
    
    
    
    
    
    
    This event returns the result of a call to the subscribeToCharacteristic or unsubscribeFromCharacteristic method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        characteristicCharacteristic
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
- 
                    
                        errorDescriptionStringThe error description; only present if an error occurred. 
updatedRSSI
    
    
    
    
    
    
    This event returns the result of a call to the readRSSI method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
- 
                    
                        errorDescriptionStringThe error description; only present if an error occurred. 
updatedValueForCharacteristic
    
    
    
    
    
    
    This event is fired after a call to the readValueForCharacteristic method, or upon receipt of a notification/indication.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        characteristicCharacteristic
- 
                    
                        valueTiBufferThe characteristic's value at the time the update was received. Note that due to the asynchronous nature of the Titanium messaging facility, the value of the characteristic may have been already updated again by the time the JavaScript code receives this event and consequently valueandcharacteristic.valuemay be different!
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
updatedValueForDescriptor
    
    
    
    
    
    
    This event returns the result of a call to the readValueForDescriptor method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        descriptorDescriptorThe Descriptor object corresponding to the descriptor parameter of the delegate method. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
- 
                    
                        errorDescriptionStringThe error description; only present if an error occurred. 
wroteValueForCharacteristic
    
    
    
    
    
    
    This event returns the result of a call to the writeValueForCharacteristic method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        characteristicCharacteristicThe object representing the characteristic that was changed. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
wroteValueForDescriptor
    
    
    
    
    
    
    This event returns the result of a call to the writeValueForDescriptor method.
Event Payload:
- 
                    
                        sourcePeripheralThe peripheral sending the event. 
- 
                    
                        descriptorDescriptorThe object representing the descriptor that was changed. 
- 
                    
                        errorCodeNumberThe error code; only present if an error occurred. 
- 
                    
                        errorDescriptionStringThe error description; only present if an error occurred. 
