},
                                  'uniqueId': unique_id
                                  }

abort_message = {'@type':'PositionerRequest',
                                    'positionType':'ABORT',
                                    'uniqueId': unique_id
                                    }

get_message = {'@type':'PositionerRequest',
                                  'positionType':'GET',
                                  'uniqueId': unique_id
                                  }

messages = [
            ('positioner-request-topic', set_message_1, 1),
            ('positioner-request-topic', set_message_2, 1),
            
            # This doesn't actually abort the move. Instead, it aborts the series of movements demanded by the
            # ScannablePositioner. You need to send a TERMINATE message on the request.device topic to stop the
            # actual movement.
            ('positioner-request-topic', abort_message, 1),
            
            # Need to plug in the unique id from before to get the positioner to use the GET command
            ('positioner-request-topic', get_message, 1),
            ]

send_all(conn, conn_dict, messages)

# Required to keep Python running indefinitely.
raw_input()
Esempio n. 2
0
    "@type": "AcquireRequest",
    "uniqueId": "c8f12aee-d56a-49f6-bc03-9c7de9415674",
    "detectorName": "mandelbrot",
    "detectorModel": {
        "@type": "MandelbrotModel",
        "name": "mandelbrot",
        "exposureTime": 0.01,
        "maxIterations": 500,
        "escapeRadius": 10.0,
        "columns": 301,
        "rows": 241,
        "points": 1000,
        "maxRealCoordinate": 1.5,
        "maxImaginaryCoordinate": 1.2,
        "realAxisName": "xNex",
        "imaginaryAxisName": "yNex",
        "enableNoise": "false",
        "noiseFreeExposureTime": 5.0,
        "timeout": -1
    },
    "filePath": tempfile,
    "status": "NONE"
}

send_all(conn, conn_dict, [("acquire-request-topic", acquire_request, 0)])

# Required to keep Python running indefinitely.
raw_input()

# You can mess around with the file, then press enter in the terminal to delete it.
os.remove(tempfile)
handlers = {'device-response-topic': MonitorHandler()}

conn = create_connection()

set_handlers(conn, handlers)

subscribe_all(conn, conn_dict, handlers)

device_request_message = {
    '@type': 'DeviceRequest',
    'deviceType': 'RUNNABLE',
    'configure': 'true',
    'deviceName': 'dkExmpl',
    'deviceAction': 'CONFIGURE',
    'deviceModel': {
        '@type': 'DarkImageModel',
        'columns': 100,
        'frequency': 100,
        'name': 'meep',
        'rows': 72
    }
}
messages = [
    ('device-request-topic', device_request_message, None),
]

send_all(conn, conn_dict, messages)

# Required to keep Python running indefinitely.
raw_input()
        yield (topic, msg, wait_time)


def create_request(new_status):
    """ Creates a request, using the previously received message and a new status."""
    msg = latest_message
    msg['previousStatus'] = msg['status']
    msg['status'] = new_status
    return msg 


# This is a list of requests to make during my test run.
command_list = [('scanning-submission-queue', "SUBMITTED", 3),
#                 ('scanning-status-topic', "REQUEST_PAUSE", 3),
#                 ('scanning-status-topic', "REQUEST_RESUME", 1),
#                 ('scanning-status-topic', "REQUEST_PAUSE", 1),
#                 ('scanning-status-topic', "REQUEST_RESUME", 0),
                # If paused beforehand, terminate will cause, on the server,
                # REQUEST_RESUME, then RESUME, then TERMINATE to avoid a bug
                # on the example client where a thread ends up hanging. This
                # behaviour may change in the future.
#                 ('scanning-status-topic', "REQUEST_TERMINATE", 0),
                ]

send_all(conn, conn_dict, generate_messages(command_list))

# Required to keep Python running indefinitely.
raw_input()

# You can mess around with the file, then press enter in the terminal to delete it.
os.remove(tempfile)
    "uniqueId": "c8f12aee-d56a-49f6-bc03-9c7de9415674",
    "detectorName": "mandelbrot",
    "detectorModel": {
        "@type": "MandelbrotModel",
        "name": "mandelbrot",
        "exposureTime": 0.01,
        "maxIterations": 500,
        "escapeRadius": 10.0,
        "columns": 301,
        "rows": 241,
        "points": 1000,
        "maxRealCoordinate": 1.5,
        "maxImaginaryCoordinate": 1.2,
        "realAxisName": "xNex",
        "imaginaryAxisName": "yNex",
        "enableNoise": "false",
        "noiseFreeExposureTime": 5.0,
        "timeout": -1,
    },
    "filePath": tempfile,
    "status": "NONE",
}

send_all(conn, conn_dict, [("acquire-request-topic", acquire_request, 0)])

# Required to keep Python running indefinitely.
raw_input()

# You can mess around with the file, then press enter in the terminal to delete it.
os.remove(tempfile)
Esempio n. 6
0

def create_request(new_status):
    """ Creates a request, using the previously received message and a new status."""
    msg = latest_message
    msg['previousStatus'] = msg['status']
    msg['status'] = new_status
    return msg


# This is a list of requests to make during my test run.
command_list = [
    ('scanning-submission-queue', "SUBMITTED", 3),
    #                 ('scanning-status-topic', "REQUEST_PAUSE", 3),
    #                 ('scanning-status-topic', "REQUEST_RESUME", 1),
    #                 ('scanning-status-topic', "REQUEST_PAUSE", 1),
    #                 ('scanning-status-topic', "REQUEST_RESUME", 0),
    # If paused beforehand, terminate will cause, on the server,
    # REQUEST_RESUME, then RESUME, then TERMINATE to avoid a bug
    # on the example client where a thread ends up hanging. This
    # behaviour may change in the future.
    #                 ('scanning-status-topic', "REQUEST_TERMINATE", 0),
]

send_all(conn, conn_dict, generate_messages(command_list))

# Required to keep Python running indefinitely.
raw_input()

# You can mess around with the file, then press enter in the terminal to delete it.
os.remove(tempfile)