X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=README.md;h=cc147f37f7008d5fe08214d6945a372dfac7dda6;hb=c3ebdae7950f96ca7beb8f2a29b79b33f3ec3438;hp=9df42ae4a83bc8a0a04bbee18ce00d9f103cb6e1;hpb=6363e0dda9e755471c49b13b90737c6a134d263e;p=libcontrac.git diff --git a/README.md b/README.md index 9df42ae..cc147f3 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,22 @@ See the draft specs: https://www.apple.com/covid19/contacttracing/ ## Install -If you have autoconf you can install as follows. +If you have autoconf you can install like this: ``` autoreconf --install ./configure make -make check make install ``` +You can also run the unit tests and build the +[documentation](https://www.flypig.co.uk/docs/libcontrac/): +``` +make check +make doxygen +``` + ## Usage Include header files. @@ -30,29 +36,28 @@ Include header files. ### Broadcasting and uploading keys -Most of the functionality revolves around the opaque `Contrac` structure. +Most of the functionality is managed through the opaque `Contrac` structure. -Create and initialise the structure as follows. The day and interval number -should be set appropriately. +Create and initialise the structure as follows. The update call updates the +Daily Tracing Key and Rolling Proximity Identifier based on the current time. ``` Contrac * contrac = contrac_new(); -contrac_generate_tracing_key(contrac); -contrac_set_day_number(contrac, 23); -contrac_set_time_interval_number(contrac, 76); +// Generates a random Tracing Key if one hasn't yet been set +contrac_update_current_time(data); ``` Get the Rolling Proximity Identifier for broadcast in Bluetooth beacons. ``` // Returns a buffer containing RPI_SIZE bytes of data -const unsigned char * rpi = contrac_get_proximity_id(contrac); +unsigned char const * rpi = contrac_get_proximity_id(contrac); ``` Get the Daily Tracing Key to upload to a Diagnosis Server in case of a positive test result. ``` // Returns a buffer containing DTK_SIZE bytes of data -const unsigned char * dtk = contrac_get_daily_key(contrac); +unsigned char const * dtk = contrac_get_daily_key(contrac); ``` ### Receiving and matching keys @@ -60,21 +65,15 @@ const unsigned char * dtk = contrac_get_daily_key(contrac); Add RPIs captured via Bluetooth to an RPI list. ``` RpiList * rpis = rpi_list_new(); - // Add bytes captured at a given time to the list -Rpi * rpi = rpi_new(); -rpi_assign(rpi, captured_bytes, time_interval_number); -rpi_list_append(rpis, rpi); +rpi_list_add_beacon(rpis, captured_bytes, time_interval_number); ``` -Construct a list of DTKs from data downloaded from a Diagnosis Server. +Construct a list of DTKs using data downloaded from a Diagnosis Server. ``` DtkList * dtks = dtk_list_new(); - -// Add data downloaded from the server to the list -Dtk * dtk = dtk_new(); -dtk_assign(dtk, dtk_bytes, day_number); -dtk_list_append(dtks, dtk); +// Add data downloaded from a Diagnosis Server to the list +dtk_list_add_diagnosis(dtks, dtk_bytes, day_number); ``` Having collected these two lists any matches can be tested for as follows. @@ -106,9 +105,11 @@ libcontrac is released under the GPL v2 Licence. Read COPYING for information on ## Contact and Links -More information can be found at: https://www.flypig.co.uk/contrac +Library home page: https://www.flypig.co.uk/contrac + +API documentation: https://www.flypig.co.uk/docs/libcontrac/ -The source code can be obtained from git: +Source code from git: ``` git clone git@www.flypig.org.uk:libcontrac ```