Beispiel #1
0
def print_device_configs(ctx):
    """
    Prints a list of device device configurations that have been configured for the current organization. 

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    """
    responseJSON = nuviot_srvc.get(ctx, '/api/deviceconfigs')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    nuviot_util.print_array("Device Configs", nuviot_util.to_item_array(rj))
Beispiel #2
0
def get_streams(ctx):
    """
    Load the details for the data streams that have been allocated for the
    the current organization

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    """
    responseJSON = nuviot_srvc.get(ctx, '/clientapi/datastreams')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    return nuviot_util.to_item_array(rj)
Beispiel #3
0
def print_streams(ctx):
    """
    Print the streams along with their ids that have been allocated for the current organization. 

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    """
    responseJSON = nuviot_srvc.get(ctx, '/clientapi/datastreams')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    return nuviot_util.print_array("Data Stream",
                                   nuviot_util.to_item_array(rj))
Beispiel #4
0
def get_devices_by_group(ctx, group_id):
    """
    Returns a list of device that belong to a specific device group. 

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    group_id:
        Group Id to return the list of devices within that group.
    """
    responseJSON = nuviot_srvc.get(
        ctx, '/clientapi/repo/group/' + group_id + '/devices')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    return nuviot_util.to_item_array(rj)
Beispiel #5
0
def get_devices(ctx):
    """
    Gets a list of devices for the device repository associated with the IoT application. 

    When a client id and token are created, they are created for a specific instance, that instance
    and the associated device repository will be used to filter the data within this response.

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    """
    responseJSON = nuviot_srvc.get(ctx, '/clientapi/devices')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    return nuviot_util.to_item_array(rj)
Beispiel #6
0
def print_devices(ctx):
    """
    Prints a list of device device groups that have been configured for the current application. 

    When a client id and token are created, they are created for a specific instance, that instance
    and the associated device repository will be used to filter the data within this response.

    Parameters
    ----------
    ctx:
        Context Object that defines how this method should call the server to include authentication.

    """
    responseJSON = nuviot_srvc.get(ctx, '/clientapi/devices')
    if responseJSON == None:
        return

    rj = json.loads(responseJSON)
    nuviot_util.print_array("Devices by Repo",
                            nuviot_util.to_item_array(rj, "deviceId"))