BluetoothLEModule Class
Item Index
Methods
- addService
- cancelPeripheralConnection
- connectPeripheral
- createBeaconRegion
- initCentralManager
- initPeripheralManager
- releaseCentralManager
- releasePeripheralManager
- removeAllServices
- removeService
- requestAlwaysAuthorization
- requestRegionState
- requestWhenInUseAuthorization
- respondToRequest
- retrieveConnectedPeripherals deprecated
- retrieveConnectedPeripheralsWithServices
- retrieveMonitoredRegions
- retrievePeripherals deprecated
- retrievePeripheralsWithIdentifiers
- setDesiredConnectionLatency
- startAdvertising
- startRangingBeacons
- startRegionMonitoring
- startScan
- stopAdvertising
- stopRangingBeacons
- stopRegionMonitoring
- stopScan
- updateValue
Properties
Constants
- ADVERT_DATA_KEY_IS_CONNECTABLE
- ADVERT_DATA_KEY_LOCAL_NAME
- ADVERT_DATA_KEY_MANUFACTURER_DATA
- ADVERT_DATA_KEY_OVERFLOW_SERVICE_UUIDS
- ADVERT_DATA_KEY_SERVICE_DATA
- ADVERT_DATA_KEY_SERVICE_UUIDS
- ADVERT_DATA_KEY_SOLICITED_SERVICE_UUIDS
- ADVERT_DATA_KEY_TX_POWER_LEVEL
- ALREADY_ADVERTISING_ERROR
- ATT_ATTRIBUTE_NOT_FOUND_ERROR
- ATT_ATTRIBUTE_NOT_LONG_ERROR
- ATT_ERROR_DOMAIN
- ATT_INSUFFICIENT_AUTHENTICATION_ERROR
- ATT_INSUFFICIENT_AUTHORIZATION_ERROR
- ATT_INSUFFICIENT_ENCRYPTION_ERROR
- ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE_ERROR
- ATT_INSUFFICIENT_RESOURCES_ERROR
- ATT_INVALID_ATTRIBUTE_VALUE_LENGTH_ERROR
- ATT_INVALID_HANDLE_ERROR
- ATT_INVALID_OFFSET_ERROR
- ATT_INVALID_PDU_ERROR
- ATT_PREPARE_QUEUE_FULL_ERROR
- ATT_READ_NOT_PERMITTED_ERROR
- ATT_REQUEST_NOT_SUPPORTED_ERROR
- ATT_SUCCESS
- ATT_UNLIKELY_ERROR
- ATT_UNSUPPORTED_GROUP_TYPE_ERROR
- ATT_WRITE_NOT_PERMITTED_ERROR
- BACKGROUND_DATA_AUTHORIZATION_STATUS_AUTHORIZED
- BACKGROUND_DATA_AUTHORIZATION_STATUS_DENIED
- BACKGROUND_DATA_AUTHORIZATION_STATUS_NOT_DETERMINED
- BACKGROUND_DATA_AUTHORIZATION_STATUS_RESTRICTED
- BEACON_PROXIMITY_FAR
- BEACON_PROXIMITY_IMMEDIATE
- BEACON_PROXIMITY_NEAR
- BEACON_PROXIMITY_UNKNOWN
- CENTRAL_MANAGER_SCAN_OPTION_KEY_ALLOW_DUPLICATES
- CENTRAL_MANAGER_STATE_POWERED_OFF
- CENTRAL_MANAGER_STATE_POWERED_ON
- CENTRAL_MANAGER_STATE_RESETTING
- CENTRAL_MANAGER_STATE_UNAUTHORIZED
- CENTRAL_MANAGER_STATE_UNINITIALIZED
- CENTRAL_MANAGER_STATE_UNKNOWN
- CENTRAL_MANAGER_STATE_UNSUPPORTED
- CHAR_PERM_NONE
- CHAR_PERM_READ_ENCRYPTED
- CHAR_PERM_READABLE
- CHAR_PERM_WRITE_ENCRYPTED
- CHAR_PERM_WRITEABLE
- CHAR_PROP_BROADCAST
- CHAR_PROP_EXTENDED_PROPERTIES
- CHAR_PROP_INDICATE
- CHAR_PROP_INDICATE_ENCRYPTION_REQUIRED
- CHAR_PROP_NOTIFY
- CHAR_PROP_NOTIFY_ENCRYPTION_REQUIRED
- CHAR_PROP_READ
- CHAR_PROP_SIGNED_WRITES
- CHAR_PROP_WRITE
- CHAR_PROP_WRITE_WITHOUT_RESPONSE
- CHARACTERISTIC_TYPE_WRITE_WITH_RESPONSE
- CHARACTERISTIC_TYPE_WRITE_WITHOUT_RESPONSE
- CONNECTION_TIMEOUT_ERROR
- ERROR_DOMAIN
- INVALID_HANDLE_ERROR
- INVALID_PARAMETERS_ERROR
- LOCATION_MANAGER_AUTHORIZATION_STATUS_AUTHORIZED
- LOCATION_MANAGER_AUTHORIZATION_STATUS_DENIED
- LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED
- LOCATION_MANAGER_AUTHORIZATION_STATUS_RESTRICTED
- NOT_CONNECTED_ERROR
- OPERATION_CANCELLED_ERROR
- OUT_OF_SPACE_ERROR
- PERIPHERAL_DISCONNECTED_ERROR
- PERIPHERAL_MANAGER_CONNECTION_LATENCY_HIGH
- PERIPHERAL_MANAGER_CONNECTION_LATENCY_LOW
- PERIPHERAL_MANAGER_CONNECTION_LATENCY_MEDIUM
- PERIPHERAL_MANAGER_STATE_POWERED_OFF
- PERIPHERAL_MANAGER_STATE_POWERED_ON
- PERIPHERAL_MANAGER_STATE_RESETTING
- PERIPHERAL_MANAGER_STATE_UNAUTHORIZED
- PERIPHERAL_MANAGER_STATE_UNINITIALIZED
- PERIPHERAL_MANAGER_STATE_UNKNOWN
- PERIPHERAL_MANAGER_STATE_UNSUPPORTED
- PERIPHERAL_STATE_CONNECTED
- PERIPHERAL_STATE_CONNECTING
- PERIPHERAL_STATE_DISCONNECTED
- REGION_STATE_INSIDE
- REGION_STATE_OUTSIDE
- REGION_STATE_UNKOWN
- UNKNOWN_ERROR
- UUID_NOT_ALLOWED_ERROR
Events
- addedService
- centralManagerStateChange
- centralSubscribed
- centralUnsubscribed
- centralWillRestoreState
- connectedPeripheral
- disconnectedPeripheral
- discoveredPeripheral
- enteredRegion
- exitedRegion
- failedToConnectPeripheral
- locationManagerAuthorizationChanged
- moduleReady
- peripheralManagerStateChange
- peripheralWillRestoreState
- proximityChange
- rangedBeacons
- readyToUpdateSubscribers
- receivedReadRequest
- receivedWriteRequests
- regionStateUpdated
- retrievedConnectedPeripherals
- retrievedMonitoredRegions
- retrievedPeripherals
- startedAdvertising
Methods
addService
-
params
Publishes a service and its associated characteristic(s) to the local database. If the service contains included services, they must be published first.
Parameters:
-
params
ObjectAn object with the following properties:
-
primary
BooleanDefines whether the service is primary.
-
characteristics
Array of ObjectsAn array of objects describing the characteristics of the service using the following properties:
-
uuid
StringString representing the characteristic's UUID. -
properties
NumberInteger representing the characteristic's properties; see the CHAR\_PROP\_* constants. -
permissions
NumberInteger representing the characteristic's permissions; see the CHAR\_PERM\_* constants. -
[data]
TiBuffer optionalA TiBuffer object, holding the value of the characteristic. Optional.
-
-
Returns:
cancelPeripheralConnection
-
peripheral:
Cancels an active or pending connection to the specified peripheral. This command is non-blocking, and any commands that are still pending to the peripheral may or may not complete.
It extremely important to note that canceling a connection does not guarantee the immediate disconnection of the underlying physical link. This can be caused by a variety of different factors, including other application(s) that hold an outstanding connection to the peripheral. However, in this situation, you will still immediately receive a disconnectedPeripheral event.
Parameters:
-
peripheral:
PeripheralA Peripheral object.
Returns:
connectPeripheral
-
params
Initiates a connection to the specified peripheral. Connection attempts never time out and, depending on the outcome, will result in a connectedPeripheral or failedToConnectPeripheral event.
Pending attempts are cancelled automatically upon deallocation of the peripheral, and explicitly via the cancelPeripheralConnection method.
Parameters:
-
params
ObjectAn object with the following properties:
-
peripheral:
PeripheralThe object representing the peripheral.
-
Returns:
createBeaconRegion
-
params
Creates a BeaconRegion object that can be used to start advertising an iBeacon.
Parameters:
-
params
ObjectAn object with the following properties (see the properties of the BeaconRegion class for details):
-
identifier
StringA unique identifier to associate with the returned region object. You use this identifier to differentiate regions within your application.
-
UUID
StringThe UUID of the beacon.
-
[major]
Number optionalThe major number of the beacon. If not specified, the major and minor numbers of the beacon are ignored.
-
[minor]
Number optionalThe minor number of the beacon. If not specified, the minor number of the beacon is ignored.
-
[notifyEntryStateOnDisplay=false]
Boolean optionalWhen set to
true
, the beacon notifications will be sent only when the user turns on the display and the device is already inside the region.
-
Returns:
initCentralManager
-
[params]
Initializes the module's internal central manager. This function must be called in an app that acts as a central before any other function can be used.
Parameters:
-
[params]
Object optionalAn object with the following properties:
-
[showPowerAlert=true]
Boolean optionalBoolean indicating that the system should, if Bluetooth is powered off when the central is instantialized, display a warning dialog to the user. This parameter was introduced in version 1.1.0 of the module.
-
[restoreIdentifier]
String optionalA string containing a unique identifier for the central manager that is being instantiated. This identifier is used by the system to identify a specific central manager instance for restoration and, therefore, must remain the same for subsequent application executions in order for the manager to be restored. See also the centralWillRestoreState event. This parameter was introduced in version 1.1.0 of the module.
-
Returns:
initPeripheralManager
-
[params]
Initializes the module's internal peripheral manager object. This function must be called in an app that acts as a peripheral before any other function can be used.
Parameters:
-
[params]
Object optionalAn object with the following properties:
-
[showPowerAlert=true]
Boolean optionalBoolean indicating that the system should, if Bluetooth is powered off when the peripheral is instantialized, display a warning dialog to the user. This parameter was introduced in version 1.1.0 of the module.
-
[restoreIdentifier]
String optionalA string containing a unique identifier for the peripheral manager that is being instantiated. This identifier is used by the system to identify a specific peripheral manager instance for restoration and, therefore, must remain the same for subsequent application executions in order for the manager to be restored. See also the peripheralWillRestoreState event. This parameter was introduced in version 1.1.0 of the module.
-
Returns:
releaseCentralManager
()
Void
Releases the module's internal central manager. This frees up the related resources, and effectively (after a time-out) tears down the connection on the peripheral side as well.
Returns:
releasePeripheralManager
()
Void
Releases the module's internal peripheral manager object. This frees up the related resources, and effectively (after a time-out) tears down the connection on the central side as well.
Returns:
removeAllServices
()
Void
Removes all published services from the local database.
Returns:
removeService
-
service
Removes a published service from the local database. If the service is included by other service(s), they must be removed first.
Parameters:
-
service
Service
Returns:
requestAlwaysAuthorization
()
Void
When the current authorization status is LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED, this method runs asynchronously and prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationAlwaysUsageDescription key in your app’s Info.plist file. The presence of that key is required when calling this method.
After the status is determined, the app will receive an locationManagerAuthorizationChanged event.
If the current authorization status is anything other than LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED, this function does nothing.
Important: You must call this function or the requestWhenInUseAuthorization function prior to using beacon services.
Requesting “Always” authorization is discouraged by Apple because of the potential negative impacts to user privacy. You should request this level of authorization only when doing so offers a genuine benefit to the user.
Returns:
requestRegionState
-
params
Retrieves the state of a region asynchronously.
Parameters:
-
params
ObjectAn object with the following properties:
-
beaconRegion
BeaconRegionThe region of interest.
-
Returns:
requestWhenInUseAuthorization
()
Void
When the current authorization status is LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED, this method runs asynchronously and prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file. The presence of that key is required when calling this method.
After the status is determined, the app will receive an locationManagerAuthorizationChanged event.
If the current authorization status is anything other than LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED, this function does nothing.
Important: You must call this function or the requestAlwaysAuthorization function prior to using beacon services.
If the user grants “when-in-use” authorization to your app, your app can range beacons but not monitor beacon regions.
Returns:
respondToRequest
-
params
Used to respond to request(s) received via the receivedReadRequest or receivedWriteRequests event.
Parameters:
-
params
ObjectAn object with the following properties:
-
request
RequestThe request to which the peripheral is responding.
-
result
NumberThe result code; see the ATT_* constants.
-
Returns:
retrieveConnectedPeripherals
()
Void
deprecated
Retrieves all peripherals that are connected to the system. Note that this set can include peripherals which were connected by other applications, which will need to be connected locally via connectPeripheral method.
The result of this operation is returned via the retrievedConnectedPeripherals event.
Returns:
retrieveConnectedPeripheralsWithServices
-
params
Retrieves all peripherals that are connected to the system and implement any
of the services listed in serviceUUIDs
. Note that this
set can include peripherals which were connected by other applications,
which will need to be connected locally via
connectPeripheral method.
The result of this operation is returned via the retrievedConnectedPeripherals event.
Parameters:
-
params
Object-
serviceUUIDs
Array of Strings
-
Returns:
retrieveMonitoredRegions
()
Void
Retrieves the currently monitored beacon regions. Note that this function will initialize the location manager if it's not already initialized. Thus this function, unlike the monitoredRegions property, is guaranteed to return the correct result in every case. In particular, this function is a key component of the restoration process that needs to take place when the app is restarted into the background in response to a beacon related event.
Important: Call this function after you attached the appropriate event handlers for the enteredRegion, exitedRegion, and regionStateUpdated events. If the app was restarted due to a beacon related event, that event will be fired immediately after this function is called.
Async function; returns the results in a retrievedMonitoredRegions event.
Returns:
retrievePeripherals
-
params
Attempts to retrieve the Peripheral
object(s) that correspond
to the specified UUIDs
.
The result of this operation is returned via the retrievedPeripherals event.
Parameters:
-
params
ObjectAn object with the following properties:
-
UUIDs
Array of StringsUUIDs of peripherals to retrieve.
-
Returns:
retrievePeripheralsWithIdentifiers
-
params
Attempts to retrieve the Peripheral
object(s) that correspond
to the specified UUIDs
.
Parameters:
-
params
ObjectAn object with the following properties:
-
UUIDs
Array of StringsUUIDs of peripherals to retrieve.
-
Returns:
setDesiredConnectionLatency
-
params
Sets the desired connection latency for an existing connection on the module's internal peripheral manager. Connection latency changes are not guaranteed, so the resultant latency may vary. If a desired latency is not set, the latency chosen by the central at the time of connection establishment will be used. Typically, it is not necessary to change the latency.
Parameters:
-
params
ObjectAn object with the following properties:
-
latency
NumberThe desired connection latency.
-
central
CentralA connected central
-
Returns:
startAdvertising
-
[params]
Instructs the module's internal peripheral manager to start advertising.
Important: You must call the initPeripheralManager function first!
Note: In the Beacons
module, this function can only be used
to advertise beacon regions.
Supported advertising data types are ADVERT_DATA_KEY_LOCAL_NAME and ADVERT_DATA_KEY_SERVICE_UUIDS. When in the foreground, an application can utilize up to 28 bytes of space in the initial advertisement data for any combination of the supported advertising data types. If this space is used up, there are an additional 10 bytes of space in the scan response that can be used only for the local name. Note that these sizes do not include the 2 bytes of header information that are required for each new data type. Any service UUIDs that do not fit in the allotted space will be added to a special "overflow" area, and can only be discovered by an iOS device that is explicitly scanning for them. While an application is in the background, the local name will not be used and all service UUIDs will be placed in the "overflow" area.
Parameters:
-
[params]
Object optionalObject containing the data to be advertised.
-
ADVERT_DATA_KEY_LOCAL_NAME
StringLocal name. Note that ADVERT_DATA_KEY_LOCAL_NAME is the constant whose value (!) is to be used as the key, like so:
params[BluetoothLE.ADVERT_DATA_KEY_LOCAL_NAME] = ...
-
ADVERT_DATA_KEY_SERVICE_UUIDS
Array of StringsService UUIDs. Note that ADVERT_DATA_KEY_SERVICE_UUIDS is the constant whose value (!) is to be used as the key, like so:
params[BluetoothLE.ADVERT_DATA_KEY_SERVICE_UUIDS] = ...
-
beaconRegion
BeaconRegionAn object created using the createBeaconRegion method. If this parameter is present, other parameters except
measuredPower
are ignored. -
[measuredPower]
Number optionalThe received signal strength indicator (RSSI) value (measured in decibels) for the device. This value represents the measured strength of the beacon from one meter away and is used during ranging. If not specified, the default value for the device will be used.
-
Returns:
startRangingBeacons
-
params
Starts the delivery of notifications for beacons in the specified region.
Parameters:
-
params
ObjectAn object with the following properties:
-
beaconRegion
BeaconRegionThe region of interest.
-
Returns:
startRegionMonitoring
-
params
Starts monitoring the specified region.
You must call this method once for each region you want to monitor. If an existing region with the same identifier is already being monitored by the application, the old region is replaced by the new one. Note that "identifier" literally means the identifier property, not the UUID! The regions you add using this method are stored in the monitoredRegions property.
Parameters:
-
params
ObjectAn object with the following properties:
-
beaconRegion
BeaconRegionThe region of interest.
-
Returns:
startScan
-
params
Starts scanning for peripherals. If the UUIDs
parameter is not
specified, all discovered peripherals will be returned, regardless of their
supported services (not recommended). If the central is already scanning with
different service UUIDs or options, the provided parameters will replace
them.
The result of this operation is returned via the discoveredPeripheral event.
Applications are allowed to scan while backgrounded, with two caveats: the scan must specify one or more service UUIDs, and the CENTRAL_MANAGER_SCAN_OPTION_KEY_ALLOW_DUPLICATES scan option will be ignored.
Parameters:
-
params
ObjectAn object with the following properties:
-
[UUIDs]
Array of Strings optionalThe UUIDs of services.
-
[options]
Object optionalKey/value pairs specifying options for the scan. Currently the only valid option is CENTRAL_MANAGER_SCAN_OPTION_KEY_ALLOW_DUPLICATES.
-
Returns:
stopAdvertising
()
Void
Instructs the module's internal peripheral manager to stop advertising.
Returns:
stopRangingBeacons
-
[params]
Stops the delivery of notifications for beacons in the specified region. If no beacon region is specified, then it stops ranging for all regions.
Parameters:
-
[params]
Object optionalAn object with the following properties:
-
beaconRegion
BeaconRegionThe region of interest.
-
Returns:
stopRegionMonitoring
-
[params]
Stops the delivery of notifications for beacons in the specified region. If no beacon region is specified, then it stops ranging for all regions.
Parameters:
-
[params]
Object optionalAn object with the following properties:
-
beaconRegion
BeaconRegionThe region of interest.
-
Returns:
stopScan
()
Void
Stops scanning for peripherals.
Returns:
updateValue
-
params
Instructs the module's internal peripheral manager to send an updated characteristic value to one or more centrals, via a notification or indication.
Parameters:
-
params
ObjectAn object with the following properties:
-
characteristic
Characteristic -
data
TiBufferThe value of the characteristic.
-
[centrals]
Array of Central objects optionalThe list of centrals that need to be updated. If not specified, all subscribed centrals will be updated.
-
Returns:
True if the update could be sent, or false if the underlying transmit queue is full. If false was returned, the readyToUpdateSubscribers event will be fired once space has become available, and the update should be re-sent if so desired.
Properties
backgroundDataAuthorizationStatus
Number
read-only
The current authorization status for sharing data while backgrounded. You can use it to detect restricted access and hide UI instead of prompting for access. Possible values are the BACKGROUND_DATA_AUTHORIZATION_STATUS_* constants.
centralManagerState
Number
read-only
State of the module's internal central manager. Its value is one of the CENTRAL_MANAGER_STATE_* constants.
filterDuplicateBeacons
Boolean
Determines whether the beacons included with the
rangedBeacons
event will be filtered for duplicates. Defaults to false
.
A beacon is considered a duplicate of another if their UUID, major, and
minor numbers are all the same.
isAdvertising
Boolean
read-only
Whether or not the the module's internal peripheral manager is currently advertising data.
locationManagerAuthorizationStatus
Number
read-only
Authorization status of the Location Manager for this app. Its value is one of the LOCATION_MANAGER_AUTHORIZATION_STATUS_* constants.
monitoredRegions
Array of BeaconRegions
read-only
The beacon regions monitored by all location manager objects. Note that this property will be undefined when the app is restarted into the background. Use the retrieveMonitoredRegions function to retrieve the list of monitored regions in that case.
peripheralManagerState
Number
read-only
State of the module's internal peripheral manager. Its value is one of the PERIPHERAL_MANAGER_STATE_* constants.
rangedRegions
Array of BeaconRegions
read-only
The regions currently being tracked using ranging.
restoredCentralManagerIdentifiers
Array of Strings
read-only
Each string in the array represents the restoration identifier for a central
manager object. This is the same string you assigned to the
restoreIdentifier
parameter of the
{{#crossLink "BluetoothLEModule/initCentralManager:method}}{{/crossLink}}
function.
restoredPeripheralManagerIdentifiers
Array of Strings
read-only
Each string in the array represents the restoration identifier for a
peripheral manager object. This is the same string you assigned to the
restoreIdentifier
parameter of the
{{#crossLink "BluetoothLEModule/initPeripheralManager:method}}{{/crossLink}}
function.
wasLocationLaunch
Boolean
read-only
True
if the application was launched due to a location event.
In the context of this module, a "location event" is an event related to
beacons. Note however that other type of location events might also trigger
the app to be launched.
Constants
ADVERT_DATA_KEY_IS_CONNECTABLE
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is a Boolean indicating whether or not the advertising event type was connectable. This can be used to determine whether or not a peripheral is connectable in that instant.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_LOCAL_NAME
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is a string, representing the local name of a peripheral.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_MANUFACTURER_DATA
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is a TiBuffer, representing the manufacturing data of the peripheral.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_OVERFLOW_SERVICE_UUIDS
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is an array of strings representing service UUIDs that were found in the "overflow" area of the advertising data. Due to the nature of the data stored in this area, UUIDs listed here are "best effort" and may not always be accurate.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_SERVICE_DATA
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is an object containing service specific advertisement data. The property names of the object are service UUIDs, and the values of the properties are TiBuffer objects.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_SERVICE_UUIDS
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is an array of strings representing service UUIDs.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_SOLICITED_SERVICE_UUIDS
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is a list of one or more
String
s, representing service UUIDs.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ADVERT_DATA_KEY_TX_POWER_LEVEL
String
The Bluetooth Low Energy specification defines several fields that may be present in the advertisement data. The ADVERT_DATA_* constants can be used as keys to define the value of these fields when advertising using the startAdvertising method, or to access the values when advertising data is received in the discoveredPeripheral event.
The value associated with this particular key is a number, representing the transmit power of a peripheral.
Note that iOS version 7.0 only supports the ADVERT_DATA_KEY_SERVICE_UUIDS and ADVERT_DATA_KEY_LOCAL_NAME fields as parameters to the startAdvertising method.
ALREADY_ADVERTISING_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_ATTRIBUTE_NOT_FOUND_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_ATTRIBUTE_NOT_LONG_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_ERROR_DOMAIN
String
One of the possible values of the errorDomain
property of
an event in case an error occurs.
ATT_INSUFFICIENT_AUTHENTICATION_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INSUFFICIENT_AUTHORIZATION_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INSUFFICIENT_ENCRYPTION_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INSUFFICIENT_RESOURCES_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INVALID_ATTRIBUTE_VALUE_LENGTH_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INVALID_HANDLE_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INVALID_OFFSET_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_INVALID_PDU_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_PREPARE_QUEUE_FULL_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_READ_NOT_PERMITTED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_REQUEST_NOT_SUPPORTED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_SUCCESS
Number
Constants to be used for the result
parameter of the
respondToRequest to indicate success.
ATT_UNLIKELY_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_UNSUPPORTED_GROUP_TYPE_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ATT_WRITE_NOT_PERMITTED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
BACKGROUND_DATA_AUTHORIZATION_STATUS_AUTHORIZED
Number
One of the possible values of the backgroundDataAuthorizationStatus property. User has authorized this application to share data while backgrounded.
BACKGROUND_DATA_AUTHORIZATION_STATUS_DENIED
Number
One of the possible values of the backgroundDataAuthorizationStatus property. User has explicitly denied this application from sharing data while backgrounded.
BACKGROUND_DATA_AUTHORIZATION_STATUS_NOT_DETERMINED
Number
One of the possible values of the backgroundDataAuthorizationStatus property. User has not yet made a choice with regards to this application.
BACKGROUND_DATA_AUTHORIZATION_STATUS_RESTRICTED
Number
One of the possible values of the backgroundDataAuthorizationStatus property. This application is not authorized to share data while backgrounded. The user cannot change this application’s status, possibly due to active restrictions such as parental controls being in place.
CENTRAL_MANAGER_SCAN_OPTION_KEY_ALLOW_DUPLICATES
String
Use this constant as a key in the options
parameter of the
startScan. The value associated with this key is a number,
indicating whether the scan should run without duplicate filtering. By
default, multiple discoveries of the same peripheral are coalesced into a
single discovery event. Disabling this filtering can have an adverse effect
on battery life and should only be used if necessary.
CENTRAL_MANAGER_STATE_RESETTING
Number
The connection with the system service was momentarily lost, update imminent.
CENTRAL_MANAGER_STATE_UNAUTHORIZED
Number
The application is not authorized to use the Bluetooth Low Energy Central role.
CENTRAL_MANAGER_STATE_UNINITIALIZED
Number
This state is reported when the central manager object maintained by the module does not (yet) exist, i.e. before initCentralManager is called or after releaseCentralManager is called.
CENTRAL_MANAGER_STATE_UNSUPPORTED
Number
The platform doesn't support the Bluetooth Low Energy Central role.
CHAR_PROP_BROADCAST
Number
Permits broadcasts of the characteristic value using a characteristic configuration descriptor. Not allowed for local characteristics.
CHAR_PROP_EXTENDED_PROPERTIES
Number
If set, additional characteristic properties are defined in the characteristic extended properties descriptor. Not allowed for local characteristics
CHAR_PROP_INDICATE_ENCRYPTION_REQUIRED
Number
If set, only trusted devices can enable indications of the characteristic value.
CHAR_PROP_NOTIFY_ENCRYPTION_REQUIRED
Number
If set, only trusted devices can enable notifications of the characteristic value.
CHAR_PROP_WRITE_WITHOUT_RESPONSE
Number
Permits writes of the characteristic value, without a response.
CHARACTERISTIC_TYPE_WRITE_WITH_RESPONSE
Number
Use this constant for the type
parameter of the
writeValueForCharacteristic method. It specifies that the write to be performed requires
a response.
CHARACTERISTIC_TYPE_WRITE_WITHOUT_RESPONSE
Number
Use this constant for the type
parameter of the
writeValueForCharacteristic method. It specifies that the write to be performed does not
require a response.
CONNECTION_TIMEOUT_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
ERROR_DOMAIN
String
One of the possible values of the errorDomain
property of
an event in case an error occurs.
INVALID_HANDLE_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
INVALID_PARAMETERS_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
LOCATION_MANAGER_AUTHORIZATION_STATUS_AUTHORIZED
Number
One of the possible values of the locationManagerAuthorizationStatus property. User has authorized this application to share data while backgrounded.
LOCATION_MANAGER_AUTHORIZATION_STATUS_DENIED
Number
One of the possible values of the locationManagerAuthorizationStatus property. The user explicitly denied the use of location services for this application or location services are currently disabled in Settings.
LOCATION_MANAGER_AUTHORIZATION_STATUS_NOT_DETERMINED
Number
One of the possible values of the locationManagerAuthorizationStatus property. The user has not yet made a choice regarding whether this application can use location services.
LOCATION_MANAGER_AUTHORIZATION_STATUS_RESTRICTED
Number
One of the possible values of the locationManagerAuthorizationStatus property. The user cannot change this application’s status, possibly due to active restrictions such as parental controls being in place.
NOT_CONNECTED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
OPERATION_CANCELLED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
OUT_OF_SPACE_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
PERIPHERAL_DISCONNECTED_ERROR
Number
One of the possible values of the errorCode
property of
an event in case an error occurs.
PERIPHERAL_MANAGER_CONNECTION_LATENCY_HIGH
Number
Prioritizes extending battery life over rapid communication.
PERIPHERAL_MANAGER_CONNECTION_LATENCY_MEDIUM
Number
A balance between communication frequency and battery life.
PERIPHERAL_MANAGER_STATE_RESETTING
Number
The connection with the system service was momentarily lost, update imminent.
PERIPHERAL_MANAGER_STATE_UNAUTHORIZED
Number
The application is not authorized to use the Bluetooth Low Energy Peripheral role.
PERIPHERAL_MANAGER_STATE_UNINITIALIZED
Number
This state is reported when the peripheral manager object maintained by the module does not (yet) exist, i.e. before initPeripheralManager is called or after releasePeripheralManager is called.
PERIPHERAL_MANAGER_STATE_UNSUPPORTED
Number
The platform doesn't support the Bluetooth Low Energy Peripheral role.
PERIPHERAL_STATE_CONNECTED
Number
One of the possible values of the state
property of
a peripheral object.
PERIPHERAL_STATE_CONNECTING
Number
One of the possible values of the state
property of
a peripheral object.
PERIPHERAL_STATE_DISCONNECTED
Number
One of the possible values of the state
property of
a peripheral object.
REGION_STATE_INSIDE
Number
One of the possible values of the state
property of the
regionStateUpdated event.
REGION_STATE_OUTSIDE
Number
One of the possible values of the state
property of the
regionStateUpdated event.
REGION_STATE_UNKOWN
Number
One of the possible values of the state
property of the
regionStateUpdated event.
Events
addedService
This event returns the result of a
addService call. If advertisement could not be started, the cause will be
detailed in the errorCode
, errorDomain
, and
errorDescription
properties.
Event Payload:
-
service
ServiceAn object representing the service that was added.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorDomain
StringThe error domain; only present if an error occurred.
-
errorDescription
StringThe error description; only peresent if an
centralManagerStateChange
Fired whenever the state of the module's internal central manager changes.
Event Payload:
-
state
NumberAn integer describing the state of the module's internal central manager. See the CENTRAL_MANAGER_STATE_* constants.
centralSubscribed
This event is fired when a central configures a characteristic to notify or indicate. It should be used as a cue to start sending updates as the characteristic value changes.
Event Payload:
-
central
CentralAn object representing the central that subscribed.
-
characteristic
CharacteristicAn object representintg the characteristic to which the central subscribed.
centralUnsubscribed
This event is fired when a central removes notifications/indications from a characteristic.
Event Payload:
-
central
CentralAn object representing the central that unsubscribed.
-
characteristic
CharacteristicAn object representintg the characteristic from which the central unsubscribed.
centralWillRestoreState
Note: This event is currently not being fired, due to a limitation in Titanium. See the "iOS to iOS" sample app for a potential workaround.
Fired when iOS relaunches the app into the background (after iOS terminated it to free up resources) to complete some Bluetooth-related task. Use this event to synchronize your app's state with the state of the Bluetooth system.
See also the restoreIdentifier
parameter of the
initCentralManager method.
Event Payload:
-
peripherals
Array of PeripheralsAn array of Peripheral objects containing all peripherals that were connected or pending connection at the time the application was terminated by the system. When possible, all known information for each peripheral will be restored, including any discovered services, characteristics and descriptors, as well as characteristic notification states.
-
serviceUUIDs
Array of StringsAn array of strings holding the UUIDs of the service(s) being scanned for at the time the application was terminated by the system.
-
scanOptions
ObjectAn object (dictionary) containing the scan options at the time the application was terminated by the system.
connectedPeripheral
This event is fired when a connection initiated by the connectPeripheral method has succeeded.
Event Payload:
-
peripheral
PeripheralAn object representing the peripheral that connected to the local central manager.
disconnectedPeripheral
Fired when a peripheral disconnects from the local central manager.
Event Payload:
-
peripheral
PeripheralAn object representing the peripheral that disconnected.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorDomain
StringThe error domain; only present if an error occurred.
-
errorDescription
StringThe error description; only peresent if an
discoveredPeripheral
Fired when a peripheral is discovered.
Event Payload:
-
peripheral
PeripheralAn object representing the peripheral that was discovered by the local central manager.
-
RSSI
NumberThe current RSSI of the peripheral, in dBm. A value of
127
is reserved and indicates the RSSI was not available. -
advertisementData
ObjectAn object holding the advertisement data (see the ADVERT_DATA_KEY_* constants).
enteredRegion
This event is fired when the user enters a monitored region.
Note: In our testing we found this event to be unreliable. This seems to be a problem with the native SDK. We recommend to use the regionStateUpdated event instead.
Event Payload:
-
region
BeaconRegionThe region in question.
exitedRegion
This event is fired when the user exits a monitored region.
Note: In our testing we found this event to be unreliable. This seems to be a problem with the native SDK. We recommend to use the regionStateUpdated event instead.
Event Payload:
-
region
BeaconRegionThe region in question.
failedToConnectPeripheral
This event is fired when a connection initiated by the connectPeripheral method fails.
Event Payload:
-
peripheral
PeripheralAn object representing the peripheral that failed to connect.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorDomain
StringThe error domain; only present if an error occurred.
-
errorDescription
StringThe error description; only peresent if an
locationManagerAuthorizationChanged
This event is fired when the authorization status of the Location Manager changes.
Event Payload:
-
status
NumberThe status code; one of the LOCATION_MANAGER_AUTHORIZATION_STATUS_* constants.
moduleReady
This event is fired when the module is ready. On iOS, this is a formality; On Android, you need to wait for this event before calling any methods on the module.
peripheralManagerStateChange
Fired whenever the state of the module's internal peripheral manager changes.
Event Payload:
-
state
NumberAn integer describing the state of the module's internal peripheral manager. See the PERIPHERAL_MANAGER_STATE_* constants.
peripheralWillRestoreState
Note: This event is currently not being fired, due to a limitation in Titanium. See the "iOS to iOS" sample app for a potential workaround.
Fired when iOS relaunches the app into the background (after iOS terminated it to free up resources) to complete some Bluetooth-related task. Use this event to synchronize your app's state with the state of the Bluetooth system.
See also the restoreIdentifier
parameter of the
initPeripheralManager method.
Event Payload:
-
services
Array of ServicesAn array of Service objects containing all services that were published to the local database at the time the application was terminated by the system. All the information about a service is restored, including any included services, characteristics, characteristic descriptors, and subscribed centrals.
-
advertisementData
ObjectAn object (dictionary) containing the data being advertised at the time the application was terminated by the system. See the startAdvertising method for more detail.
proximityChange
Use this event to determine which beacons have changed their proximity since the last update. This event is fired whenever the rangedBeacons event is fired, provided that the proximity of any of the ranged beacons has changed since the last rangedBeacons event.
Event Payload:
-
beacons
Array of BeaconsAn array of Beacon objects representing the beacons that changed their proximity since the last update.
rangedBeacons
Use this event to determine which beacons are in range.
See also the filterDuplicateBeacons property.
Event Payload:
-
beacons
Array of BeaconsAn array of Beacon objects representing the beacons currently in range. You can use the information in these objects to determine the range of each beacon and its identifying information.
-
region
BeaconRegionThe region object containing the parameters that were used to locate the beacons.
readyToUpdateSubscribers
This event is fired after a failed call to updateValue, when the module's internal peripheral manager is again ready to send characteristic value updates.
receivedReadRequest
This event is fired when the module's internal peripheral manager receives a read request.
Event Payload:
-
request
RequestAn object representing the request.
receivedWriteRequests
This event is fired when the module's internal peripheral manager receives
a write request for one or more characteristics. For every invocation of this
method,
respondToRequest should be called exactly once. If the requests
parameter contains multiple requests, they must be treated as an atomic unit.
If the execution of one of the requests would cause a failure, the request
and error reason should be provided and none of the requests should be
executed.
Event Payload:
-
requests
Array of Request objectsRequest objects describing the incoming write requests.
regionStateUpdated
This event is fired when the state of a monitored region is updated.
Event Payload:
-
region
BeaconRegionThe region object containing the parameters that were used to locate the beacons.
-
state
NumberOne of the REGION_STATE_* constants.
retrievedConnectedPeripherals
This event returns the result of the retrieveConnectedPeripherals method.
Event Payload:
-
service
ServiceA Service object representing the service that was added.
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorDomain
StringThe error domain; only present if an error occurred.
-
errorDescription
StringThe error description; only peresent if an
retrievedMonitoredRegions
Returns the result of the retrieveMonitoredRegions function.
Event Payload:
-
beaconRegions
Array of BeaconRegionsAn array of BeaconRegion objects, representing the currently monitored beacon regions.
retrievedPeripherals
This event returns the result of the retrievePeripherals method.
Event Payload:
-
peripherals
Array of Peripheral objects
startedAdvertising
This event returns the result of a
startAdvertising call. If advertisement could not be started, the cause will be
detailed in the errorCode
, errorDomain
, and
errorDescription
properties.
Event Payload:
-
errorCode
NumberThe error code; only present if an error occurred.
-
errorDomain
StringThe error domain; only present if an error occurred.
-
errorDescription
StringThe error description; only peresent if an


2.2. Searching in an Array¶
2.2.1. Searching in an Array¶
<IP_ADDRESS>. Sequential Search¶
If you want to find the position in an unsorted array of \(n\) objects that stores a particular value, you cannot really do better than simply looking through the array from the beginning and move toward the end until you find what you are looking for. This algorithm is called sequential search. If you do find it, we call this a successful search. If the value is not in the array, eventually you will reach the end. We will call this an unsuccessful search. Here is a simple implementation for sequential search.
Sequential(A: array, k: integer)
for i = 1 to arraySize(A) do
if A[i] == k
return i
return arraySize(A)
// Return the position of the element `e` in array `elements`.
// If `e` is not found, return -1.
static E sequentialSearch(E[] elements, E e) {
for (int i = 0; i < elements.length; i++) { // For each element
if (elements[i].equals(e)) { // if we found it
return i; // return this position
}
}
return -1; // Otherwise, return -1
}
# Return the position of the element `e` in the array `elements`.
# If `e` is not found, return -1.
def sequentialSearch(elements, e):
for i in range(len(elements)): # For each element
if elements[i] == e: # if we found it
return i # return this position
return -1 # Otherwise, return -1
It is natural to ask how long a program or algorithm will take to run. But we do not really care exactly how long a particular program will run on a particular computer. We just want some sort of estimate that will let us compare one approach to solving a problem with another. This is the basic idea of algorithm analysis. In the case of sequential search, it is easy to see that if the value is in position \(i\) of the array, then sequential search will look at \(i\) values to find it. If the value is not in the array at all, then we must look at \(n\) values if the array holds \(n\) values. This would be called the worst case for sequential search. Since the amount of work is proportional to \(n\), we say that the worst case for sequential search has linear cost. For this reason, the sequential search algorithm is sometimes called linear search.
<IP_ADDRESS>. Binary Search¶
Sequential search is the best that we can do when trying to find a value in an unsorted array. 1 But if the array is sorted in increasing order by value, then we can do much better. We use a process called binary search.
Binary search begins by examining the value in the middle position of the array; call this position \(mid\) and the corresponding value \(k_{mid}\). If \(k_{mid} = K\), then processing can stop immediately. This is unlikely to be the case, however. Fortunately, knowing the middle value provides useful information that can help guide the search process. In particular, if \(k_{mid} > K\), then you know that the value \(K\) cannot appear in the array at any position greater than \(mid\). Thus, you can eliminate future search in the upper half of the array. Conversely, if \(k_{mid} < K\), then you know that you can ignore all positions in the array less than \(mid\). Either way, half of the positions are eliminated from further consideration. Binary search next looks at the middle position in that part of the array where value \(K\) may exist. The value at this position again allows us to eliminate half of the remaining positions from consideration. This process repeats until either the desired value is found, or there are no positions remaining in the array that might contain the value \(K\). Here is an illustration of the binary search method.
And here is the method in more programming languages:
// Return the position of the element `e` in the sorted array `elements`.
// If `e` is not found, return -1.
public static <E extends Comparable<E>> binarySearch(E[] elements, E e) {
int low = 0;
int high = elements.length - 1;
while (low <= high) { // Stop when low and high meet
int mid = (low + high) / 2; // Check middle of subarray
if (elements[mid].compareTo(e) < 0) {
low = mid + 1; // In right half
} else if (elements[mid].compareTo(e) > 0) {
high = mid - 1; // In left half
} else {
return mid; // Found it
}
}
return -1; // Search value not in array
}
# Return the position of the element `e` in the sorted array `elements`.
# If `e` is not found, return -1.
def binarySearch(elements, e):
low = 0
high = len(elements) - 1
while low <= high: # Stop when low and high meet
mid = (low + high) // 2 # Check middle of subarray
if elements[mid] < e:
low = mid + 1 # In right half
elif elements[mid] > e:
high = mid - 1 # In left half
else:
return mid # Found it
return -1 # Search value not in array
With the right math techniques, it is not too hard to show that the cost of binary search on an array of \(n\) values is at most \(\log n\). This is because we are repeatedly splitting the size of the subarray that we must look at in half. We stop (in the worst case) when we reach a subarray of size 1. And we can only cut the value of \(n\) in half \(\log n\) times before we reach 1. 2
- 1
It seems to be really “obvious” that sequential search is the best that you can do on an unsorted array. But writing a convincing proof that no algorithm could ever be discovered that is better is surprisingly difficult. This is an example of a lower bounds proof to find the cost for the best possible algorithm to solve the problem of search in an unsorted array.
- 2
It is possible to prove that binary search is the most efficient algorithm possible in the worst case when searching in a sorted array. This is even more difficult than proving that sequential search is the most efficient algorithm possible on an unsorted array.


{% extends 'layout-bsa.html' %} {% block pageTitle %} Apply online - LIS training - NHSBSA {% endblock %} {% block outerContent %} {% endblock %} {% block content %}
This is a new online service and we're only inviting a limited number of people to apply.
If you apply online you will:
If you apply online, we'll use the information you have already provided to help complete your application form. You can find out more about how we use your information (Opens in a new window).


Sky Blue Entertainment Company was formally established in 2020. Its main business includes music production, artist management. In addition to music, it is also responsible for film production, as well as multimedia.
We hope our life can be different. No one can know how long our life is, and what will happen in the future. Since we have our heart to do music and film production, we are not going to postpone, and do it right now.
Blue is the colour of sky. For me, sky is representing dreams. So our name is ‘Sky Blue Entertainment Company’, hope to use this name to remind everyone that we must be always full of dreams and whether in a valley or despair, stick to our dreams. As long as you stick to it, your dream will come true one day.


Dangerous Beauty: The Trial of a CourtesanBy Michael Asimow, UCLA Law School (May 1998) The film Dangerous Beauty is about Veronica Franco, a Venetian courtesan who lived from 1546-1591. The movie is loosely based on The Honest Courtesan (Univ. of Chicago Press, 1992), a scholarly book by Margaret F. Rosenthal, who is a professor of Italian at USC. The film is interesting to law and popular culture junkies because it culminates with Francos witchcraft trial before the Inquisition. But before we get to the trial, lets talk about 16th Century Venice and the real Veronica Franco (played by Catherine McCormack in the film). Venice, founded in myth by Venus rising from the sea, always featured two closely linked iconic visions of the goddessas pure and inviolate virgin and as symbol of love and pleasure. And at the time everybody associated Venice with love and pleasure. Some historians believe that there were an astounding 11,000 prostitutes in 16th century Venice out of a total population of about 100,000 (Rosenthal finds the figure exaggerated but even half that number would be amazing). Essentially, a young Venetian women who aspired to a decent lifestyle could enter a convent, marry a rich man (which required the woman to come up with a substantial dowry), or become a courtesan (essentially a high-priced prostitute). Although not shown in the film, Franco did in fact marry a physician as a young woman, but that marriage soon ended. Somehow her parents came up with the necessary dowry (which Franco fought for years to reclaim from her husband). Franco then became a courtesan (as her mother had once been). Franco acquired rich and powerful patrons, such as Dominico Venier. As a result, she achieved astounding upward mobility. She acquired an excellent education, although how she managed it is unknown. She had a successful career as a poet. Tintoretto painted her portrait, which is featured on the front of Rosenthals book, which shows that she was quite fetching. The film correctly reflects the difference in lifestyles between successful courtesans and wives of rich men. Wives were cloistered creatures without education or financial independence, their life devoted entirely to home and family. Courtesans, on the other hand, could mingle freely with the rich and famous, acquire education and wealth of their own, participate in literary, political and intellectual circles, and even publish their work. Franco was incredibly successful in this milieu; between 1570 and 1580, she edited works of various authors and published books of her poetry as well as epistolary works. She was greatly concerned with the plight of younger women who lacked dowries; her published letters often refer to their plight and her wills left money to help poor women. Francos success inspired extreme jealousy from male courtiers and poets whose position and patronage she greatly threatened. As in the film, a particularly venomous rival was Maffio Venier, a nephew of Francos patron Domenico Venier. Maffio repeatedly attacked Franco by name in satirical and often obscene verse. Francos poems and letters effectively strike back at Maffio and defend the role of courtesans in Venetian society. Although the film does not show it, Franco struggled to raise a number of children; she had six, all by different fathers, of whom three sons survived infancy.  The love story between Franco and Marco Venier (Domenicos other nephew), which is central to the film, is apparently greatly exaggerated (although there is evidence that the two were intimate in real life). As in the film, Franco really had an erotic encounter with King Henri III of France when he arrived in town (Franco was evidently a major tourist attraction). Because the patronage of the King of France would be exceptional valuable, Franco wrote poems about Henri and dedicated works of poetry to him. However, their actual relationship did not have the historic importance ascribed to it in the film. In the movie, after a delightful night of machistic lovemaking with Franco, Henri makes French naval power available to Venice in its war with the Turks. The first two thirds of the film are basically a fun sex romp with poetry contests, beautiful costumes, and stunning views of Venice. I, for one, found the film lacking in emotional resonance, although a majority of those Ive asked about it (particularly women) really liked it and empathized strongly with Francos character. One student remarked that she found the film incredibly empowering. The last third of the film turns dark. The plague (and numerous other misfortunes) savaged Venice from 1575-77 and many women, especially courtesans, are placed on trial by the Inquisition. The theory is that the tragedies that befall Venice resulted from its licentious lifestyle. Thus prostitutes are set up to take the fall. In the film, Franco is accused of witchcraft, since she had obviously bewitched legions of men. She makes a stirring statement on behalf of women, however, and is saved from certain death when her many clients are shamed by Marco into standing up for her. In real life, Franco was in fact tried twice by the Inquisition in 1580 for the alleged offense of performing heretical incantations in her home. Chapter 5 of Rosenthals book contains a wealth of interesting and valuable information about the various inquisitorial trials for heresy and witchcraft that occurred around this time in Venice and about Francos trials in particular. Nobody in Venice was condemned to death or severely tortured as a result of these trials, but conviction would mean public humiliation and severe penalties such as banishment. Franco was denounced anonymously by Ridolfo Vanitelli, her sons tutor. Vanitellis denunciation may have been intended as revenge, because Franco had earlier cast suspicion on him when she reported a theft of various precious items from her home. She was then robbed again, and Vanitelli may have feared that she would accuse him of being the thief; thus his denunciation of Franco may have been a preemptive strike. Vanitelli accused her of performing incantations that were designed to discover the identity of the thief (and also to inspire various merchants to love her). His accusations also dwelt on her behavior as a prostitute and reflected his intense envy at her wealth and powerful friends. And for good measure, he accused her of eating meat on Fridays. The charge of performing heretical incantations was potentially quite serious because of the risk that she might be invoking the power of the devil. The trials were strictly in the inquisitorial mode; there were no witnesses or defense counsel. The trial consisted of Franco being interrogated by the inquisitor. Fortunately, Franco was very experienced in defending herself against invective from rivals such as Maffio Venier; she used this experience to good effect in her trials. Once again, Domenico Veniers patronage was invaluable; Rosenthal believes that Domenicos influence resulted in the failure of the Inquisition to proceed against her after the initial interrogations. In both of the trials, Franco admitted performing superstitious rituals in her home, but claimed she did not take them seriously. She tried to shift blame, by saying the rituals were the idea of her neighbors and her servants, including Vanitelli. At the right moment, she was contrite. She emphatically denied eating meat or other forbidden foods on Friday, except when she was seriously ill or pregnant (which was often). She steadfastly denied that diabolism was involved in any ritual. She remained composed at all times, despite the peril of the situation. The trials were suspended without findings and no witnesses were ever called against her. Despite the ambiguously favorable conclusion of the trials, events did not go in Francos favor. By 1582, Domenico Venier was dead and Franco was impoverished. She never recovered the stolen articles. Although Francos inquisitorial trials lacked the high drama ascribed to them in Dangerous Beauty, the actual events were nevertheless quite fascinating, particularly Francos skill in parrying a determined inquisitor. Francos life is truly inspiring.  Overcoming powerful legal and literary adversaries, she attained fame as a published poet and author and became a participant in the intellectual and political events of her time. She is a historic figure worthy of our attention and admiration more than four hundred years after her death.
|


|
Fig. 1
|
Coastal counties along the US Atlantic and Gulf Coasts (numb ... |
|
Fig. 2
|
Flood return period curves for the historical period of 1980 ... |
|
Fig. 3
|
Projected flood hazards along the US Atlantic and Gulf Coast ... |
|
Fig. 4
|
Projected contributions of SLR and TC climatology change to ... |
|
Fig. 5
|
Projected changes in TC characteristics from the historical ... |


Class StereoPinholeCameraUndistortion
Manages the undistortion and rectification process for pinhole StereoArucoCamera.
Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
StereoPinholeCameraUndistortion
Implements
Inherited Members
Namespace: ArucoUnity.Cameras.Undistortions
Assembly: Assembly-CSharp.dll
Syntax
public class StereoPinholeCameraUndistortion : PinholeCameraUndistortionGeneric<StereoArucoCamera>, IArucoCameraUndistortion, IArucoCameraController, IConfigurableController, IHasArucoCameraParameters
Properties
| Improve this Doc View SourceRectificationZeroDisparity
Gets or sets if the principal point of the images have the same pixel coordinates in the rectified views (true by default). Only applied if using a stereo camera.
Declaration
public bool RectificationZeroDisparity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceConfiguring()
Declaration
protected override void Configuring()
Overrides
| Improve this Doc View SourceInitializeRectification()
Declaration
protected override void InitializeRectification()


Back
Trying it out
Great! Get in touch with the team if you have any questions.
[Some content/links about when to get in touch about a full account]
Great! Get in touch with the team if you have any questions.
[Some content/links about when to get in touch about a full account]


Survey
Home
Equipment
Rules
Survey
SURVEY
Name:
E-mail:
Age:
On the scale of 1 and 10 how much did you learn
1
10
What is something you learned?
submit


Technical Electives
- Speech Processing
- Machine Learning
- Computer Vision
- Big Data Tools and Methods
- Cloud Computing
- iOS App Development (SwiftUI)
- Advanced Statistics
- Linear Algebra
- Discrete Mathematics
- User Centered Design
- Operating Systems
- Object Oriented Programming
- Data Structures & Algorithms
- Database Management Systems


--- title: "What's up in Dawson County, NE?" author: "Drew Tyre" date: '2020-05-19' output: pdf_document: default html_document: code_folding: hide word_document: default og_image: /post/covid19-dawson-county_files/figure-html/featured_image-1.png draft: no slug: covid19-dawson-county tags_include: - R - OPD - COVID19 categories: Research ---
SOMEBODY READ MY BLOG! And had a question, even better:
I’m reading your latest entyrely too much post and I can’t help wondering, is there a discrepancy between the information presented? In the first plot, it looks as if Dawson county is still exponentially growing but when singled out as a county and plotted per 100,000 people, the graph is more or less flat, the date range is similar enough that it seems the data would be similar but maybe I’m missing something.
This is the post. I’m not proud of that post, it was done in a rush, and the first figure in particular is terrible. There are too many counties on it and it is hard to figure out which dots match which counties. However, it wouldn’t be my first public mistake, so let us take a closer look at Dawson county. For non-Nebraskan readers, Dawson county is along I-80 and the Platte River, west of Kearney. Lexington is the county seat.
The first post in this series was March 13, in case you’re just joining and want to see the progression.
DISCLAIMER: These unofficial results are not peer reviewed, and should not be treated as such. My goal is to learn about forecasting in real time, how simple models compare with more complex models, and even how to compare different models.1
For this analysis I’m going to the NY Times dataset directly, which has data for the USA broken
down by county. I’m also testing out a data package I contributed to – wnvdata
2 –
has county level census
data so I can calculate per capita case rates.
library("tidyverse")
library("lubridate")
library("broom")
library("EpiEstim")
library("grid")
library("gridExtra")
library("gtable")
source("R/plot_functions.R")
# wnvdata package only from github.com/akeyel/wnvdata
census_data <- wnvdata::census.data %>%
filter(year == 2019) %>%
select(fips,POP)
nytimes_counties <- read_csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv")
ne_counties <- nytimes_counties %>%
filter(state == "Nebraska",
county == "Dawson") %>%
mutate(maxcases = max(cases))
linear <- ggplot(data = ne_counties,
mapping = aes(x = date, y = cases)) +
geom_point() +
# scale_y_log10() +
labs(x = "Date",
y = "Cumulative confirmed cases")
county_data <- ne_counties %>%
group_by(county) %>%
summarize(fips = last(fips)) %>%
left_join(census_data)
# makes a "tyreplot"
dawson <- plot_nytimes_counties(ne_counties,
county_data,
case_cutoff = 20,
exclude = c())
# make a custom version for a single county from the data
logarithmic <- ggplot(data = filter(dawson$data, day >= 0),
mapping = aes(x = date)) +
geom_point(mapping = aes(y = active)) +
scale_y_log10() +
geom_line(data = dawson$fits,
mapping = aes(y = fit),
size = 1.25) +
geom_ribbon(data = dawson$fits,
mapping = aes(ymin = lcl, ymax = ucl),
alpha = 0.2) +
geom_line(data = dawson$predictions,
mapping = aes(y = fit),
linetype = 2) +
geom_ribbon(data = dawson$predictions,
mapping = aes(ymin = lpl, ymax = upl),
alpha = 0.2) +
labs(y = "Active/recovered cases \n per 100,000 population",
x = paste0("Date since 20th case"))
# put plots side-by-side
grid.arrange(linear, logarithmic, ncol = 2,
bottom = textGrob("Solid line: exponential model; Dashed line: forecast cases with 95% prediction intervals.", hjust = 1, x = 1),
top = textGrob("Cumulative cases of COVID-19 for Dawson County, NE. Data from NY Times"))
On a first glance, there is a big difference visually. The left hand plot is increasing while the right hand plot is not increasing (or not as quickly). The data are the same (or nearly, see below), but the vertical axes are scaled differently. On the left is a linear scale. With a linear scale the distance from one tick mark to the next is the same (200 cases, in this plot). On the right is a base 10 logarithmic scale. With this transformation the distance between tick marks is 10x greater than the previous one! There is one other difference; the right hand plot is cases / 100,000 population. In this case plotting a per capita rate is not changing the message, because the population of Dawson county isn’t changing.
The discrepancy is not a mistake. It is important to understand the differences between linear and logarithmic scales, because they tell very different stories! And the news media are throwing both around willy-nilly. If I want to sensationalize what is happening in Dawson county, I should use the left hand plot. Look how fast the disease is spreading! However, if I want to emphasize just how effective the citizens of Dawson county are at social distancing, I would use the right hand plot. The advantage of the right hand plot is that exponential growth appears linear. That’s the fitted line over the first two weeks. If Dawsonites are successfully lowering the rate of growth, the points start to fall away from the expected growth (the dashed line). If you know what to look for the slowdown is evident in the left hand plot as well, but it isn’t easy to see. The logarithmic scale makes it blatantly obvious.
There are two other subtle differences in the data between plots. The right hand plot has confirmed deaths subtracted. As of this writing 7 people have died from COVID-19 in Dawson county, so that isn’t making a big difference. The other difference is the right hand x axis starts on the day with 20 cases reported, not when the first case is reported. If I started the left hand plot on April 14, the apparent increase would be smaller, but not enough to account for the big visual difference.
Telling stories with data is fun, but as always, reader beware! Subtle choices made by the analyst can make for dramatic shifts in emphasis from the same data.
This package isn’t available on CRAN. Get it on Github.↩


{% extends 'base.html' %} {% load i18n %} {% load bootstrap3 %} {% load embed_video_tags %} {% load staticfiles %} {% block head %} {{ webform.media }} {% endblock %} {% block breadcrumb %}
This is where you will see all active assignments. Click here to create a pitch.
{% endif %}It appears you've not pitched any stories.
Click here to create a pitch.
{% endif %}It appears you've not received any pitches.
{% endif %}You do not have any open calls at this time.
{% endif %}


Chasing The Tangents
Exploring My Thinking Style
So phase-0 has been everything I've expected it to be and more. I've been inspired, motivated, challenged and utterly defeated. I've found myself humbled by my peers and everything that we've been able to learn from one another. Frankly, I'm humbled by just how much I don't know... That isn't to say that I'm not enjoying the experience, on the contrary, in today's day and age it's difficult to find this kind of stimuli.  I go off on tangents about 90% of the time, no really that's not an exaggeration, but that's because for the first time in a long time I've found myself in an environment conducive to my style of thinking.
During week-0 of phase-0 we were asked to determine our thinking style based off of the Gregorc Thinking Style by Professor Anthony Gregorc. He defines these styles as Cocrete Sequential, Concrete Random Thinkers, Abstract Random, and Abstract Sequential. Of these, it would seem that I'm both a Concrete Sequential and Abstract Random thinker.
Concrete Sequential thinkers tend to process information in an ordered linear way. The way I interpret it, this seems like an excellent explanation for my tangents. I've loved reading all the sources, so much so that if a source references another source I'll follow that, and so on and so forth. The topics we're learning about here are more than anything I could have expected, and it's this curiosity and hunger to learn that has me straying away from what a particular challenge might be asking of me.
Whether you choose to think of it as a complement or complete contrast there's also the Abstract Random thinking style. Professor Gregorc describes these thinkers by their desire to organize information through reflection. They thrive in people oriented environments with minimal structure. This leads my to the most invaluable source of knowledge I've found here at DBC, my fellow cohort mates. It seems that for every bit of knowledge I pick up on my own, there's someone there sharing two new resource, or a new browser extension, I've even found myself inspired to do my own research and learn how responsive design works just because someone asked a question about frameworks.
However you choose to interpret these thinking styles I can promise you one thing, they're here to stay. I'm not ready just yet to put a limit on my tangents, but I am working on prioritizing what needs to be done. Now more than ever timeboxing has been a big help. By starting off a challenge and specifying how much time I intend to work on each release I've set myself up to complete my required workload with ample time left over to chase the tangents.
If having a particular thinking style wasn't enough to wrap your head around, try to imagine that we also have different mindsets. I wont go into explaining the difference because that in itself is a fun read growth vs. fixed mindset. I will say this, how can you know what you need to know if you don't know what you don't know? Say what? Exactly.  Even here in phase-0, we're actively learning new things, but every one of these topics goes so much deeper and there's so much more information out there that we might not even know exists yet. So question everything, research everything, and yes chase the tangents! Accept that you'll never stop learning and frankly you should never want to because for every one thing you learn there will be two more unanswered questions.


Hi all.
There has been relatively few discussion about this, but the RF range is linked to the RF bitrate.
Lowering the bitrate will in essence reduce the required RF-signal bandwidth .
The range improvement is due to the fact that available RF-power is divided on the bandwidth. (A narrow signal will travel further than a broader one, if the power is constant.)
If you need (or want) both power and bandwidth to be untouched, you'll have to change antenna.
After a quick search on the forum, it looks like I'm pretty much the only one talking about bitrate modification. Apparently, people are satisfied with the default one. Or maybe they complain about the range but don't link it to the bitrate.
Anyway, I have been in a situation where I couldn't get the signal to reach my emonBase and lowering the bitrate was the cure. The thread says that there may have been issues on the TX in the first place (bad soldering of the antenna, bad powering of the RF module through the step-up regulator). But the fact is that in a difficult setup, the bitrate change made the difference.
I opened an issue on GitHub to propose a parameter to modify the bitrate. It shouldn't be too difficult. The question is whether this is useful or not. If everyone is happy with the range (or if range issues are mostly due to a cause that is identified and can be solved otherwise, like bad soldering or anything), maybe it is not worth developing this and adding a new confusing option to the end user.
I'm opening this thread to get your opinions about this.
I'm surprised there is so few persons with range issues (in fact I've seen threads where people ask for an RF repeater). Don't you instrument huge buildings ? What if lowering the bitrate saved you from adding a repeater, for instance ?
Re: Range issues ? What about changing the RF bitrate ?
Hi Jérôme, it would be interesting if you could describe your scenario: building / number walls, distance between nodes.
Re: Range issues ? What about changing the RF bitrate ?
Well, what I described was in my former house. The base was in the garage, so it was like:
emonBase - 3m - garage door (wood, about 2cm) - 1.5m - caravan (metal, 3m length) - 2.5m - vegetal hedge - gas meter with emonTX inside
The distance was not the issue: a TX placed further but so that the caravan wouldn't be in the way could reach the base.
And when the TX was in a room, it could reach the base through a few brick walls.
Re: Range issues ? What about changing the RF bitrate ?
I have lots of problems with radio dropout so much so that I've turned off ACKs on most of my nodes as they seemed to be blocking each other. It seems to mainly be a problem when sending multiple data items in one transmission (bigger packets I assume) and if a lower bitrate would help that would be great. I'm even looking at changing the code to cope with missing data where this is important (e.g. rain tipping bucket pulses from my weather station) as I often have gaps of a few minutes in receiving data from nodes that are transmitting every minute. I've even tried a full wave antenna at the receiver without much improvement.
Re: Range issues ? What about changing the RF bitrate ?
I believe NeilK found that 600 mm thick masonry walls gave him problems and he saw an improvement when he lowered the bit rate.
Re: Range issues ? What about changing the RF bitrate ?
Hi Jérôme,
Using EmonTX/TH is large buildings, I'm not happy with the range (maximum 2/3 walls/floors).
So if modifying the biterate can improve the range, it is worth developing this feature !
Eric
Re: Range issues ? What about changing the RF bitrate ?
I had also reception problems with an emonTH and a Jeelink that were fixed by lowering the bitrate with rf12_control.
I have also asked in that thread, is there any downside to lowering the rate? I can't think and haven't noticed any problems since lowering the bitrate (I have set mine to 3.918kbps).
Re: Range issues ? What about changing the RF bitrate ?
The only downside of lowering the bitrate, AFAIK, is that the same packet will take more time to transfer.
I think one node is not "allowed" to emit for too long (how long ? says who ? source needed).
Besides, this increases the risk of several nodes emitting in the same time. Bra1n, if you have nodes blocking each other (as in speaking in the same time), then I'm not sure it will help.
Those of you who are interested and able to fiddle a bit with the code can copy what I did in the code I link to in the GitHub issue. The TX part is dead easy. The base part is not more difficult to code, but it needs to setup the environment to compile the sketch (not arduino default) and reflash the base (this can be done from the Pi if you're using a Pi).
Thank you for your answers. There seems to be an interest, so it is worth digging into this.
Re: Range issues ? What about changing the RF bitrate ?
Most of the information you need is somewhere on the JeeLabs site. The rules are for the proportion of the time that one transmitter is transmitting, therefore if you lengthen the time it takes to transmit one message, you need to increase the gap between messages (or send less bytes). "Who says" is International Treaties, backed up by National laws. There are very many bands in the RF spectrum and each has its own rules, which vary from country to country and area to area.
Re: Range issues ? What about changing the RF bitrate ?
Yes. I'm pretty sure I remember reading about this on this forum (or in the doc). With precise figures and all. But we shall take a look at the Jeelabs website for reference. At least.
Re: Range issues ? What about changing the RF bitrate ?
Lowering the bit rate is only part of the story. In brief, a lower bit rate can use a lower frequency deviation - this results in a narrower spectrum around the nominal carrier. Adjusting the RxBandwidth down to match allows less junk into the receiver section. Result - higher signal to noise ratio which is really where the best range gain comes from.
There are limits - setting the RxBandwidth to the minimum requires that the corresponding pairs of crystals on the communicating RF modules agree closely on their versions of '10MHz'. A few ppm is auto corrected by the AFC - a larger ppm delta can take the received signal partly out of the RxBandwidth filter passband, causing the AFC and hence the entire packet reception to fail.
The current settings are at a sweet spot of range/energy consumed per packet (lower bit rates of course take longer, consequently more joules eaten). If remote node battery life is not an issue and the chosen RF channel is lightly loaded, then slowing right down to even 1200baud can have substantial range gains (provided the corresponding tweaks are made as described plus probably a little crystal tuning).
Re: Range issues ? What about changing the RF bitrate ?
Thanks Martin.
Good point about the battery usage. This advocates for the search of a better trade-off instead of just picking the lowest bitrate.
Do you mean that by lowering the bitrate I gained in SNR but only a part of what I could have gained if I had also adjusted the Rx BW ? Is this what you refer to as "corresponding tweaks" ? Is this achievable with the RFM12 or RF69 ?
In the GitHub thread, Paul says that for compatibility reasons, it would be even better to propose this upstream (Jeelib). Or maybe they didn't do it because they thought it was not such a good idea. In which case it is still a good idea to raise the point there.
Re: Range issues ? What about changing the RF bitrate ?
@Jérôme,
> lowering the bitrate .. gains... in SNR
No, not at all. Lowering the bitrate lowers the minimum SNR needed to decode the signal.
Reducing the RxBandwidth improves the SNR. Think of it as a squarish window on the RF world - the amount of RF junk picked up is proportional to the width of the window (the 'noise' in the SNR formula). Provided the useful part of the transmitted spectrum fits neatly into the window, that is the 'signal'. Hence the improvement in ratio which maps to more range.
Chopping off one side of the received spectrum by mismatch in the two crystals, and/or chopping off both sides by an overly narrow filter gives worse results, since the information required to recover the modulation is smeared around in the whole of the transmitted spectrum (with repeats in the side lobes).
Oversimplified, but close enough for a guideline. If you really want to get deeper into the dark mysteries of FSK, prepare for a dunking into Bessel functions etc.
Note that the magic table in the RFM12B spec sheet about sweetspot combinations of the key parameters (bit rate, deviation, RxBW) is hard to follow since there is an additional constraint in play - the limited, quantized choices for RxBW. The RFM69 series has more flexibility here, plus a more sensitive receiver section. Provided there is not too wide a mix of incoming signal strengths, the RFM69 in general will squeeze out more range with like-for-like parameter settings.
Re: Range issues ? What about changing the RF bitrate ?
Right. My formulation was incorrect.
Thanks again for the explanations.
I studied signal processing a while ago. I suppose if I had the time I could dig into the datasheets, docs, etc. and discuss this here or at Jeelabs. But it is not reasonable. I don't have that kind of time, let alone the skills, and I guess other people at Jeelabs have been thinking about this much more than I did and are way ahead of me.
As a RFM12B or RFM69 user, I am sort of a client of the Jeelib, I never really meant to hack into it.
I just observed that lowering the bitrate (by using the bitrate feature proposed in the jeelib (the #define in the .h file)) did improve my communication and thought I might as well share that and try to facilitate it by adding a simple feature in the code.
In the Jee code, the job is half done, somehow, as the bitrate #define exist but are not used in the code.
If you have grounds to believe that we shouldn't use this feature because it can worsen things, or if you think the Jeelib manages the bitrate it in a way that is not optimal, then please warn us so that we can wonder where we should go from here: forget about it all, see with people at Jeelabs how this could be improved, etc.
I don't want to push a feature that will be a mess. I don't think I even need it anymore myself (I used it in my former house and never switched back). It just seems like other people have had (or expect to have) range issues, and this seemed like an easy improvement.
(In fact, if I manage to use OpenEnergyMonitor someday at work, it is likely to be in big buildings where the range will be an issue, so an easy config would be nice. So I do have an interest in this.)
Re: Range issues ? What about changing the RF bitrate ?
Lowering the bit rate is not new. MartinR used the technique a while ago. My view - and I too am not an expert on communications theory - is that the chosen default values are a good choice in most circumstances, but as has been pointed out above, lowering the bit rate too far, or indiscriminately, would usually not be an advantage and could be a major disadvantage. Done with discretion and only when necessary, it is a useful tool.
Re: Range issues ? What about changing the RF bitrate ?
I just want my modules to work and currently they don't work well enough, to the point that I'm looking to use cabling and serial communication where at all possible. I'm not talking about long range here either just one side of a modest house to the other, maybe there are other avenues I can explore like reducing transmission packet size but lowering bit rate seems like a good option.
Re: Range issues ? What about changing the RF bitrate ?
Hello Bra1n,
I've even tried a full wave antenna at the receiver without much improvement.
The impedance of an end fed 1/2, or full wave antenna is quite high, typically 1800 ohms or so, but definitely not the 50 to 75 ohms the RFM12 (and lots of other radio frequency transmitter/receiver equipment) wants to be connected to. The resulting mismatch causes a significant amount of RF energy loss affecting the strength of both the radiated, and received signals. End result, poor range.
Your best bet is to use a 1/4 wave antenna with a counterpoise (aka a ground plane). Here's a link that shows how easy it can be to build one: http://www.rcgroups.com/forums/showthread.php?t=1333382.
Connecting the feed line to the RFM12 can be an issue, but if small diameter coaxial cable, say something like RG-174, is used, and the length kept to a meter or less, the results will be a considerable improvement over the 1/4 wave wire antenna alone. One solution is to buy a pre-made cable that has an SMA or BNC male connector on one or both ends and use a female SMA/BNC connector at the antenna feedpoint. It's even possible to build one with no connector at all. The link above has pictures and instructions for two slightly different build methods, neither with RF connectors at the antenna.
Regards,
Bill
Re: Range issues ? What about changing the RF bitrate ?
@Bra1n: You seem to be in the same case I was in my former house. Although a user-friendly "bitrate selection" feature has not been implemented already, you could try to modify the bitrate yourself. See my links above. The TX part is the easy part. Just one line or two in the init. The Base part is pretty much the same code-wise, but the extra amount of work is the flashing of the RFM2Pi board. You need to setup avrdude and all. See the docs. If you can reflash the RFM2Pi with the stock firmware and it works, then the most difficult part is done. Modifying the code to hardcode another bitrate is piece of cake.
Re: Range issues ? What about changing the RF bitrate ?
Thanks for the tips Bill and Jerome, I'll get back onto that when I've finished sorting my CCTV issues out.
Re: Range issues ? What about changing the RF bitrate ?
This link (found on top of RF12.h bitrate section) deals with bitrate and bandwidth:
http://blog.strobotics.com.au/2009/07/27/rfm12-tutorial-part-3a/
I moved to RFM69 now. From what I understand, the bit rate setting mechanism is different from the RFM12.
For RFM12, see page 17 of datasheet and above link.
For RFM69, see page 19 of datasheet.
As far as I understand, the bitrate setting was not implemented in the Jeelib RFM69 driver. But I may be wrong. (Can anyone confirm ?)
If this is the case, it will be a bit harder to add this feature here: need to add it to the driver first.
It would also mean that the few people using other bitrates are currently stuck on RFM12.
Re: Range issues ? What about changing the RF bitrate ?
Are you saying it cannot be done by writing to the Arduino SPI, as MartinR did in his PLL energy diverter for the RFM12B?
(N.B. I'm not saying I've even looked at the problem!)
Re: Range issues ? What about changing the RF bitrate ?
I'm sorry, I might not have looked deep enough into it myself, and I don't have a clue what you're talking about.
What I'm saying is that I could achieve it easily with the RF12 driver thanks to this enum
and the rf12_control() function.
Just use rf12_control(RF12_DATA_RATE_1) and you're done.
However, AFAIU, the command and registers differ on the RFM69 and there is no equivalent in the RF69 driver.
I may (and I hope I am) misleaded.
Re: Range issues ? What about changing the RF bitrate ?
In MartinR's sketch, he includes SPI.h, and he has a function:
Then to set up the RFM12B, he uses:
which I guess is much the same as the library does. If you do go this way, it would be a good idea to reverse engineer the library for the RFM69CW to check what it does set up, then do the same but change the settings you want changing. OK, I see it is harder this way, but it looks possible while the library catches up.
Re: Range issues ? What about changing the RF bitrate ?
Yes, he uses the 0xC6xx command to set a bit rate, like the RFM12 lib does.
I didn't see anything similar in the RFM69 lib, but I don't claim I took an extensive look.
I think the whole code above is RFM12 specific and would require adaptation to RFM69.


Sorry, I should stop you first.
Due to the confidentiality of the page, you should provide the password.


ACE VENTURA: PET DETECTIVE A Film Review Copyright Dragan Antulov 2000
Jim Carrey is one of the most talented comic actors of our time, but his reputation often suffered because of the critics' snobbery. Carrey still suffers because of the huge popularity of his early movies, especially comedies that relied solely on his comedic talent and hardly anything else, causing animosity among critics who demanded higher standards of American film comedy. ACE VENTURA, 1994 hit film by Tom Shadyac that turn Carrey into the mega-star is one of those films that explain why some critics don't like Carrey and why this actor didn't get his well- deserved "Oscar".
The protagonist of this film, with screenplay co-written by Shadyac, Carrey and Jack Bernstein, is Ace Ventura (played by Carrey), private detective specialised in locating and retrieving lost pets. His talents are spotted attention of Miami Dolphins football team, whose owner hires him to find team's mascot - dolphin named Snowflake. In his quest Carrey is aided by Dolphins publicist Melissa Robinson (played by Courtney Cox), while inimical police lieutenant Lois Eichorn (played by Sean Young) thwarts his investigation. When Dolphins star Dan Marino (played by himself) also disappears, Ventura's investigation receives further complications.
ACE VENTURA: PET DETECTIVE is a film almost without the plot but that doesn't discourage Carrey. Instead the lack of meaningful story is seen as an opportunity for him to display his great comedic talent, including almost indescribable skills of physical comedy. Humour is often bellow standards of good taste and definitely not suited for children, especially in scenes that spoof CRYING GAME. All supporting actors seem uncomfortable or disinterested for their roles. However, as long as Carrey appears on screen the film is truly hilarious, and since Carrey appears with 86 minutes, many of those shortcomings can be forgiven. At least by those viewers who want nothing more than light-hearted entertainment and comedic talent in its barest essence.
RATING: 5/10 (++)
Review written on July 19th 2000
Dragan Antulov a.k.a. Drax Fido: 2:381/100 E-mail<EMAIL_ADDRESS>E-mail<EMAIL_ADDRESS>E-mail<EMAIL_ADDRESS>Filmske recenzije na hrvatskom/Movie Reviews in Croatian http://film.purger.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews