Starting application testing for dev environment (everytime)

Follow the procedure to perform application testing for Dev environment

  1. Get the sdkservice_wrapper and sample application in the same directory.

  2. Open new terminal and activate virtualenv

    $ py3

  3. Run the command cd to change the path to our sample application directory.

  4. Edit the sample_app.py and change the value of 'server' variable to store controller_IP_Address.

  5. Run the following command to test the sample application

    $ python3 sample_app.py

    If you are creating your own application follow the below instructions.

  6. Import the SDKService class from sdkservice_wrapper into your application.

  7. Create an instance of SDKService class with two arguments (server=controller_IP_Address, port=18812)

    sdk = SDKService('controller_IP_Address', '18812')

  8. Using this 'sdk' instance you can invoke the following methods with the arguments mentioned.

    => Arguments inside [ ] are optional

S.No

Method Signature

Description

1

sdk.get_adapter ( [gateway_id] )

Use this method to get available radios for the given gateway_mac. If gateway_id is not provided you will get available radios of all the gateways configured with controller IP.

2

sdk.scan (gateway_id, network_mac, scan_callback, gap_name[, uuid, scan_interval, scan_window, scan_dur] )

Use this method to start scan with the given gateway and network mac, and you need to define a scan_callback to get the results

3

sdk.connect (gateway_id, network_mac, dev_addr, addr_type, pass_key, auto_connect, connect_callback)

Use this method to connect with given device, and you need to define a connect_callback to get the connection status

4

sdk.discover_services(gateway_id, network_mac, dev_addr, conn_handle, service_callback)

Use this method to discover the services of given device, and you need to define a service_callback to get the service results containing service and characteristic details.

5

sdk.read_characteristic(gateway_id, network_mac, dev_addr, conn_handle, char_uuid, char_handle)

Use this method to get the value of characteristic specified.

6

sdk.write_characteristic(gateway_id, network_mac, dev_addr, conn_handle, char_uuid, char_handle, value, value_len, ack_flag)

Use this method to set/write the value of characteristic specified.

7

sdk.set_char_notif_or_indication(gateway_id, network_mac, dev_addr, conn_handle, char_uuid, char_handle, notif_flag, notif_callback)

Use this method to set/reset notification/indication of characteristic specified if it supports notification/indication.

8

sdk.disconnect(gateway_id, network_mac, dev_addr, conn_handle)

Use this method to disconnect the given device with gateway.