C# 클래스 SensorbergSDK.Internal.Utils.BeaconFactory

Creates beacon instances from received advertisement data. Can also turn beacon instances back to advertisement data.
파일 보기 프로젝트 열기: sensorberg-dev/windows10-sdk

공개 메소드들

메소드 설명
BeaconCodeToString ( ushort beaconCode ) : string

Converts the given beacon code to string.

BeaconFromBluetoothLeAdvertisementReceivedEventArgs ( BluetoothLEAdvertisementReceivedEventArgs args ) : Beacon

Constructs a Beacon instance and sets the properties based on the given data.

BeaconFromByteArray ( [ data ) : Beacon

Constructs a Beacon instance and sets the properties based on the given data. The expected specification of the data is as follows: Byte(s) Name -------------------------- 0-1 Manufacturer ID (16-bit unsigned integer, big endian) 2-3 Beacon code (two 8-bit unsigned integers, but can be considered as one 16-bit unsigned integer in little endian) 4-19 ID1 (UUID) 20-21 ID2 (16-bit unsigned integer, big endian) 22-23 ID3 (16-bit unsigned integer, big endian) 24 Measured Power (signed 8-bit integer) 25 Additional information byte (optional) For more details on the beacon specifications see https://github.com/AltBeacon/spec The minimum length of the given byte array is 25. If it is longer than 26 bits, everything after the 26th bit is ignored.

BeaconFromDataSection ( BluetoothLEAdvertisementDataSection dataSection ) : Beacon

Constructs a Beacon instance and sets the properties based on the given data.

BeaconFromDataSectionList ( IList dataSections ) : Beacon

Constructs a Beacon instance and sets the properties based on the given data.

BeaconManufacturerData ( ushort manufacturerId, ushort beaconCode ) : BluetoothLEManufacturerData

Creates a BluetoothLEManufacturerData instance based on the given manufacturer ID and beacon code. The returned instance can be used as a filter for a BLE advertisement watcher.

BeaconToSecondDataSection ( Beacon beacon, bool includeAuxByte = false ) : BluetoothLEAdvertisementDataSection

Creates the second part of the beacon advertizing packet. Uses the beacon IDs 1, 2, 3 and measured power to create the data section.

CalculateDistanceFromRssi ( double rawSignalStrengthInDBm, int measuredPower ) : double

Calculates the beacon distance based on the given values. http://developer.radiusnetworks.com/2014/12/04/fundamentals-of-beacon-ranging.html

DataSectionToRawString ( BluetoothLEAdvertisementDataSection dataSection ) : string

Converts the data of the given BluetoothLEAdvertisementDataSection to a string.

FormatUuid ( string uuid ) : string

Formats the given UUID. The method also accepts strings, which do not have the full UUID (are shorter than expected). Too long strings are truncated. An example of a formatted UUID: de305d54-75b4-431b-adb2-eb6b9e546014

ManufacturerIdToString ( ushort manufacturerId ) : string

Converts the given manufacturer ID to string.

UuidToAdvertisementBytePattern ( string uuid, ushort manufacturerId, ushort beaconCode ) : BluetoothLEAdvertisementBytePattern

Constructs a BluetoothLEAdvertisementBytePattern instance from the given UUID. UUID doesn't have to be full 32 hex digits, but length needs to be even.

비공개 메소드들

메소드 설명
ChangeInt16ArrayEndianess ( byte byteArray ) : byte[]

Switches the endianess of the given byte array so that every two bytes are switched.

HexStringToByteArray ( string hexString ) : byte[]

Converts the given hex string to byte array.

메소드 상세

BeaconCodeToString() 공개 정적인 메소드

Converts the given beacon code to string.
public static BeaconCodeToString ( ushort beaconCode ) : string
beaconCode ushort The beacon code as Uint16.
리턴 string

BeaconFromBluetoothLeAdvertisementReceivedEventArgs() 공개 정적인 메소드

Constructs a Beacon instance and sets the properties based on the given data.
public static BeaconFromBluetoothLeAdvertisementReceivedEventArgs ( BluetoothLEAdvertisementReceivedEventArgs args ) : Beacon
args BluetoothLEAdvertisementReceivedEventArgs
리턴 Beacon

BeaconFromByteArray() 공개 정적인 메소드

Constructs a Beacon instance and sets the properties based on the given data. The expected specification of the data is as follows: Byte(s) Name -------------------------- 0-1 Manufacturer ID (16-bit unsigned integer, big endian) 2-3 Beacon code (two 8-bit unsigned integers, but can be considered as one 16-bit unsigned integer in little endian) 4-19 ID1 (UUID) 20-21 ID2 (16-bit unsigned integer, big endian) 22-23 ID3 (16-bit unsigned integer, big endian) 24 Measured Power (signed 8-bit integer) 25 Additional information byte (optional) For more details on the beacon specifications see https://github.com/AltBeacon/spec The minimum length of the given byte array is 25. If it is longer than 26 bits, everything after the 26th bit is ignored.
public static BeaconFromByteArray ( [ data ) : Beacon
data [ The data to populate the Beacon instance properties with.
리턴 Beacon

BeaconFromDataSection() 공개 정적인 메소드

Constructs a Beacon instance and sets the properties based on the given data.
public static BeaconFromDataSection ( BluetoothLEAdvertisementDataSection dataSection ) : Beacon
dataSection BluetoothLEAdvertisementDataSection A data section containing beacon data.
리턴 Beacon

BeaconFromDataSectionList() 공개 정적인 메소드

Constructs a Beacon instance and sets the properties based on the given data.
public static BeaconFromDataSectionList ( IList dataSections ) : Beacon
dataSections IList A data section containing beacon data.
리턴 Beacon

BeaconManufacturerData() 공개 정적인 메소드

Creates a BluetoothLEManufacturerData instance based on the given manufacturer ID and beacon code. The returned instance can be used as a filter for a BLE advertisement watcher.
public static BeaconManufacturerData ( ushort manufacturerId, ushort beaconCode ) : BluetoothLEManufacturerData
manufacturerId ushort The manufacturer ID.
beaconCode ushort The beacon code.
리턴 BluetoothLEManufacturerData

BeaconToSecondDataSection() 공개 정적인 메소드

Creates the second part of the beacon advertizing packet. Uses the beacon IDs 1, 2, 3 and measured power to create the data section.
public static BeaconToSecondDataSection ( Beacon beacon, bool includeAuxByte = false ) : BluetoothLEAdvertisementDataSection
beacon Beacon A beacon instance.
includeAuxByte bool Defines whether we should add the additional byte or not.
리턴 BluetoothLEAdvertisementDataSection

CalculateDistanceFromRssi() 공개 정적인 메소드

Calculates the beacon distance based on the given values. http://developer.radiusnetworks.com/2014/12/04/fundamentals-of-beacon-ranging.html
public static CalculateDistanceFromRssi ( double rawSignalStrengthInDBm, int measuredPower ) : double
rawSignalStrengthInDBm double The detected signal strength.
measuredPower int The device specific measured power as reported by the beacon.
리턴 double

DataSectionToRawString() 공개 정적인 메소드

Converts the data of the given BluetoothLEAdvertisementDataSection to a string.
public static DataSectionToRawString ( BluetoothLEAdvertisementDataSection dataSection ) : string
dataSection BluetoothLEAdvertisementDataSection The data section instance.
리턴 string

FormatUuid() 공개 정적인 메소드

Formats the given UUID. The method also accepts strings, which do not have the full UUID (are shorter than expected). Too long strings are truncated. An example of a formatted UUID: de305d54-75b4-431b-adb2-eb6b9e546014
public static FormatUuid ( string uuid ) : string
uuid string A UUID to format.
리턴 string

ManufacturerIdToString() 공개 정적인 메소드

Converts the given manufacturer ID to string.
public static ManufacturerIdToString ( ushort manufacturerId ) : string
manufacturerId ushort The manufacturer ID as Uint16.
리턴 string

UuidToAdvertisementBytePattern() 공개 정적인 메소드

Constructs a BluetoothLEAdvertisementBytePattern instance from the given UUID. UUID doesn't have to be full 32 hex digits, but length needs to be even.
public static UuidToAdvertisementBytePattern ( string uuid, ushort manufacturerId, ushort beaconCode ) : BluetoothLEAdvertisementBytePattern
uuid string The UUID.
manufacturerId ushort The manufacturer ID.
beaconCode ushort The beacon code.
리턴 BluetoothLEAdvertisementBytePattern