27.09.2014 Views

PDF (double-sided) - Physics Department, UCSB - University of ...

PDF (double-sided) - Physics Department, UCSB - University of ...

PDF (double-sided) - Physics Department, UCSB - University of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

waiting for their completion. The Client then needs to be able to sort through<br />

the Replies to re-associate them with their corresponding Requests. This is done<br />

by tagging every outgoing Request with a unique, positive Request ID. When a<br />

Server handles the Request, it tags the Reply with the negative <strong>of</strong> the Request<br />

ID (Request 5 yields Reply -5). It should always be possible for the API to take<br />

care <strong>of</strong> the entire management <strong>of</strong> these Request IDs.<br />

Therefore, if an API is<br />

written well, the Module developer should not ever have to come in contact with<br />

Request IDs. For the development <strong>of</strong> Server Modules, the API can even hide the<br />

entire Packet structure <strong>of</strong> incoming Requests by always passing the Requests to<br />

the Server on a Record by Record basis. This way, the Server developer does not<br />

need to be concerned at all about whether, for example, two Request arrived as<br />

two Packets with one Record each or as one Packet with two Records. By being<br />

in sole charge <strong>of</strong> the construction <strong>of</strong> the Reply Packet, the API can then enforce<br />

the correct Packet structure to ensure compliance with the LabRAD protocol.<br />

The LabRAD APIs should also assist Server development as much as possible<br />

with the management <strong>of</strong> Contexts. Contexts are intended to provide a method<br />

for Server Modules to maintain data that persists across Requests. For example,<br />

a Client might select a device it would like to use. To reduce redundant traffic,<br />

the Server should be able to remember this selection as well as any relevant device<br />

settings for future Requests. For this, Contexts provide an index into a memory<br />

148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!