Материал из Module developer
Перейти к: навигация, поиск

SubDevice.GetServices

Get BLE services of a device

Синтаксис

SubDevice.GetServices()

Название Пример Описание


На выходе
Array type: Array
Array of service objects


Пример

var l_oDevice = module.CreateDevice(IR.DEVICE_BLE_DEVICE, "Kettle", UUID); //Creating a BLE device
var l_oSubDevice = module.AddSubDevice("SubDevice 1", l_oDevice); //creating a subdevice 
l_oSubDevice.DiscoverServices(); //discovering services 
module.AddListener(IR.EVENT_SERVICES_DISCOVERED, l_oSubDevice, function(){
var l_aServices = l_oSubDevice.GetServices(); //Getting services
    for (var i = 0; i < l_aServices.length; i++) {
		...
	}
});

Fields of service objects (OPTIONAL marker means that the field is not obligatory, TO_DELETE means that they can be later on deleted, as their realization is practically useless):

  • Uuid: (String) - Service ID
  • Value: (Array) - OPTIONAL, TO_DELETE Service value is almost always empty