

2014-04-03 kent headley <headley@mbari.org>
- bug fix [xf-task.c]: sometimes the gateway would hang on shutdown, after signaling the first
  sampling worker thread to stop. Inserted checks of the xftask interrupted member during
  wait_worker (sem_trywait/sem_wait) to bail out if interrupted.

2014-04-02.1 kent headley <headley@mbari.org>
- configure.ac: new revision [0.40]
- changed signature of prule post and pub functions; they are now symmetric and
  take a prule, topic and data-container. The topic is redundant in most cases,
  since the prule contains a post/pub topic, but other components that publish data
  may not have/use a prule to pub/post data. This also eliminates the need for
  dreactor to maintain a special pub socket. 
  Files affected:
  xf-data.c,h
  xf-dreactor.c
  test-dreactor.c
  
 
2014-04-02 kent headley <headley@mbari.org>

- added xf-psclient.c,h: easy-to-use pubsub client. may be configures as subsciber and/or publisher.
  sub client may be used in either an asynchronous mode by configuring it with a message handler; a separate
  thread managed by psclient receives messages and passes them to the handler. In synchronous mode, the
  user calls psclient_sub_recv in the foreground thread. The subscriber may apply (string) filters that 
  use the first frame of the message as the key. Clients may use multi-part messages, as long as they can use
  the key to differentiate message types and handle the data appropriately; psclient in general uses
  zmsg_t throughout. 
- added test-ps

- gateway.c, data.c: gateway now has a psclient_t instance, and the prule pub method in data.c now
  uses the psclient to publish data in a simple key:value (pub_topic:sdata) format. This eliminates the
  need for the xmsg_t class.

- xf-xmsg.c deprecated (replaced by xf-psclient.c)
- xf-psclient.c deprecated (replaced by gw-subc.c)

- replaced ps-client.c (client now uses xf-psclient, previously used xmsg)

- renamed gw app sources related to pub sub: 
  ps-client.c->gw-subc.c:subc (note that now gw-subc uses psclient_t)
  ps-server.c,h -> gw-subs.c,h:subs
  ps-launch.c -> gw-pslaunch.c:subs

- bug-fix:[configure.ac, various Makefile.am] - fixed problems that were breaking bitbake build. 
  In this configure.ac, included empty case for bitbake architecture so that oebb could configure its own environment.
  The existing case for beaglebone build is preserved, so it can be built on the target.
  Also, some of the data_x_DATA entries in several Makefiles were breaking oebb do_install. They were not 
  specifying a sub-directory, so files with the same name would try to overwrite each other in /usr/share.
  Now correctly creates subdirs for these.
  
- somehow, qfoce.conf was not in the repo; added now

2014-03-31 kent headley <headley@mbari.org>
- configure.ac: new revision [0.33], added some environment for trying to cross-compile.
- bug: some of the definitions for setting up the compilation environment in configure.ac 
  break the bitbake build. If needed, removing these from configure.ac will allow bitbake to build.
  This version *should* build under bitbake.
- xf-config.c: implemented module-level debug setting via gq;
- added SPI device support. Each SPI device has a node on /dev (/dev/spidev<bus>.<chip_sel>). SPI bus enumerations
  are 1-indexed (devices on spi0 -> spidev2.x). In this rev, only spi1 is supported. 
  New files:
  - bbone-spi.c,h
  - xf-spi.c,h
  - xf-spi-bbspi.c,h
  - test-spi.c
  - beaglebone-xfoce-enable-SPI21-v2.patch [kernel patch to configure SPI bus/driver for xfoce at boot]
  Modified:
  - xf-ral.h,c
  - xf-api.h
  - xf-config.c,h
- gateway.c,h, config.c,h, *.conf: now using configuration item "proxy_hport" to set the TCP/IP port
  used by the proxy to connect back to the host for get/do operations (proviously hard coded) 
- motor-control.c: added status return option
- gwcard: now deletes temporary mount directories and added some verbose messages
- bug-fix [repotar]: was backing up an old directory...yikes.
- bug-fix [xf-dio-bbdio.c]: debug message was referencing incorrect API function in intialize

2014-03-25 kent headley <headley@mbari.org>
- xf-data.c - changed sdata destructor, added sdata free
- clone.c, gateway.c - bug fix: was leaking memory when the server sent delete updates, and also the clone was not getting heartbeats.
  To fix heartbeats, changed gateway sdclient to consumer instead of producer (pending:why don't producers get hbeats?).
  To fix memleak, server SET update handler checks for zero len update and deletes local hash copy. Also, client SET stores
  locally as kvmsg instead of body value (was supposed to have done that earlier, but still storing only the message body).

- sbe18s.c: implemented tref topic as property
- sbe52mp.c: implemented pump speed property
- TCP/Port config: changed tcp port configuration, and made fully configurable throughout (previously, gateway used fixed, default port
  values). This is to enable multiple gateways to run on the same machine. Cleaned up configuration (added config object) to SD and PS client/servers
  that didn't have them. Renamed configuration file parameter config_port to proxy_port. Added new io_tcpaddr_ methods to io.c 
  affects: gateway, config, xkey, xf_xhash_platform, sd-client, ps-client, xf-sdclient, xf-psserver, clonecli6, clonesrv6 etc.
- xf-utils.c: added macros for stringification and token pasting (concatenation); used to generate default zmq endpoint addresses from default ports
- renamed term-motor.c motor-control.c, and renamed mut to moco.
- fixed up formatting on sdc and subc output

2014-03-18 kent headley <headley@mbari.org>
-  new revision [0.32]
- xf-buffer.c: fixed a long-standing bug in xfbuf_printf; mal-adjusted pointer caused incorrect NULL insertion
  which would sometimes (state-dependent) truncate the strings.
- devicecraft.c: major revision adding protocol, parsing, actuation, initialization
- ersatz.c: renamed methods to match API changes
- hrph.c: renamed methods to match API changes
- proxr.c: renamed methods to match API changes
- sbe-common.c: new; has common SBE API
- sbe18s.c: moved some API to sbe-common.c, added metadata and other protocol features
- sbe19s.c: removed cruft
- xf-config.c, xf-gateway.c, xf-proxcli.c, xf-proxsvr.c, xf-gmsg.c, xf-xkey.c, gw-query.c : added actuation plumbing
- xf-xfhash-platform.c: fixed bug (added checks for NULL values)
- xf-debug.c: added/moved modules
- xf-driver.c: added support for new drivers, starting to move away from methods that return driver 
   callbacks, and towards directing all calls through the driver operation request so that concurrency 
   can be managed. Added acutation op, renamed some other ops.
- xf-io.c, xf-io-*: allow NULL buffer to pass into io_readto (does skip until match/limit/timeout)
- test-driver.c: added tests for new drivers protocols
- test-ioport.c, various drivers: bug fix: potential loop forever on io_drain 
- log-show.c: bug fix (or create?): would not read source_id from command file; changed list push to add in process_args
- config updates: (gateway.conf, simple.conf)
- script updates: (socatd.sh (stop now doesn't depend on PID files), .xfenv (added alias goxf='cd $XF_HOME'))
- added script:  xflog (aliases vim -R for BBONE) to page logs read-only
- added drivers: sbe52mp, proxr
  
2014-02-27 kent headley <headley@mbari.org>

- established driver structural convention: develop separate device/procotol and application/driver APIs.
  The device/protocol API is application-independent, takes only abstract IO port and operation parameters.
  The application/driver API uses the device/protocol API to build application functions (e.g. initialize, 
  take a sample, etc.). 
  This enables the device driver to be tested independently (need only create an IO instance,e.g.) and
  also used to build other applications (e.g. command line utils to operate devices when system is not running).
  
- added test-driver.c: unit test driver application and/or device APIs
- added drivers 
  - hrph (MBARI pH)
  - proxr (MEH relay board+ADC)
- support for new drivers
  - xf-driver.c
  - xf-debug.c
  - Makefiles
  - simple.conf, gateway.conf
-  xf-id.h: 
  - removed obsolete hard-coded source IDs
  - added ids for new devices
- xf-io-snlib.c
  - additional NULL checks to prevent crashes for non-existing devices
- xf-io-term.c
  - replaced some fprintf ferr w/ MDEBUG
  - added NULL check for fstream in fputs
- xf-io.c
  - added memory initialization
  - added io_srid2type
  - added stream/fd closure/NULL to io destructor
  - added io_sys_release in test
  - created io_test_cfg and constructor/destructor (in io.c,h)
- xf-xhash.c
  - added vfile_dump and renamed vfile_dump to vfile_idump
  - fixed related incomplete arg list call to vfile_dump in xf-proxcli (see Scary Compiler Feature)
- xf-proxsvr.c
  - added initializers for client.request, client.next_event in ctor
- xf-utils
  - added bin2asc (binary buffer to ascii hex string)
- xf-xvalue.c
  - added xvalue_parse_json; property parsing helper function
- xf-properties.h
  - updates props_clookup macro to do NULL checking
- devicecraft.c
  - under construction
- ersatz.c
  - replaced property key array with map_entry
  - added include
  - moved code, added comments
- hrph.c
  - branched sbe18s into new file, since it's significantly different from sbe18s
- sbe18s.c
  - moved cal/constants into proper device properties
  - created cal struct
  - better separation of protocol and policy APIs
  - added new functions (standard SBE metadata functions)
  - added write/read function sbe18s_getxx as foundation of many other functions
  - simplified property parsing
  - comments
- test-driver.c
  - added xprox
- test-ioport.c
  - now use io_test_cfg in other apps that need io ports (e.g. test-driver)
  
- gateway.c:
  - fixed incomplete commands 
- Scary Compiler Feature/Bug Discovered: the compiler allows function calls with incomplete
  parameter lists. At least Valgrind will flag them as unitialized data created on the stack.

2014-01-29 kent headley <headley@mbari.org>
* configure.ac
  - bumped revision to 0.31
* Major revision of information lookup/key API
* replaced xf-xhash topic functions and data with new module, xf-xkey.c
* xf-xkey provides simpler, (type) safer functions for generating keys used
  to query a gateway proxy. There are two major parts to the API: one for
  command line clients (cli), the other for machine-to-machine clients (m2m).
  The cli interface includes methods for generating keys from (user input) strings.
  The m2m interface features functions for generating keys using IDs, making it 
  easier for developers to write clients.The key naming scheme as been refined 
  somewhat and features
  - simple and consistent syntax for obtaining and using keys
  - CLI syntax designed for easy/minimal typing
  - simple queries for related groups or single parameters
* implemented some proxy SET operations
  - Pass in gateway reference to proxy handler and update handler so that they may
    call config methods
  - implemented parsing/conversion/lookup functions to exchange keys and IDs
  - implemented set entry point in config.c (and some delegate set functions)
* defined props_validate_fn typedef (drivers should implement to validate device specific properties)
* added xf-names.h to hold const string name values
* updated gw_query: use xkeys, help message, filtering/sorting for ioprops (TODO: use cleaner io_props 
  algorithms for sorting and filtering schemes elsewhere)

2014-01-17 kent headley <headley@mbari.org>
* configure.ac
  - added checks for canonical build type that set
    environment (eliminates need to run gwconf before configure)
  - bumped revision to 0.30
* renamed viman and vitem
  - viman -> xhash
  - vitem -> xvalue
  - functions and methods: vim_->xhash_, vitem_->xvalue_
  - .c,h files xf-viman*->xf-xhash*
  - .c,h files xf-vitem*->xf-xvalue*
  - related data structures and constants were also renamed
  - eliminated viops_t and related functions in xvalue
* fixed fifo_test return value in test-queue.c
* bug fix: in test-xhash.c, xhash_hdump went into infinite loop
* bug fix: xf-buffer.c, xfbuf_new not returning value, xfbuf_destroy should have void return.
* bug fix: xf-xmsg.c, kmsg.c: fixed Valgrind errors (invalid read) that started appearing.
    malloc'd buffer wasn't initialized correctly. Unclear why this didn't appear 
    earlier (stale deps? lib update? configure.ac environment?)
* bug fix: xf-xhash.c: xhash_subtopic_key did not return (NULL) value on failure

2014-01-14 kent headley <headley@mbari.org>
* xf-buffer.c
  - fixed bugs and expanded test for xfbuf_printf
* xf-jobq.c
  - added command line settings
  - added/changed some state variables
  - updated critical sections
  - modified debug code
* test-jobq.c
  - updated test code to use multiple queues and multiple job generators
  - added config struct
* test-proxs.c
  - restructured test code to use jobq and run in threads more like it does 
    in the application (mostly to facilitate debugging the proxy bug)
* xf-gateway.c
  - added s_gw_snapshot method (not yet used)
* xf-proxsvr.c
  - bug fix: removed bad host heartbeat code that flooded the gateway with hbeat messages, causing
   the  proxy to crash after 30 min. 
* Removed instances where zmsg_destroy was called after zmsg_send, since zmsg_send destroys 
  messages after sending. Potentially, this would cause a race condition.

2014-01-06 kent headley <headley@mbari.org>
* gwrun.c, test-gateway.c: 
  - updated gwrun signal handling to match gw internals/test-gateway.c
  - removed obsolete code and variables
  - test-gateway uses config struct instead of discrete static vars
* doxygen-examples.c: comments, whitespace

2014-01-05 kent headley <headley@mbari.org>
* general style maintenance pass and cruft removal
  - converted existing doxygen comments to C++ style i.e. '///'
  - made whitespace and function formats consistent 
  - all files have consistent IP disclaimers
* added doxygen test file in doc
* added zmqv (prints zmq version)
* bug fix: test-vim 
  - xf-viman.c: after update to gwcfg_destroy,
    was passing wrong type to gwcfg_destroy in
    s_init_item_hash() [crashed test-vim].
  - added missing modules (XF_VIMAN, XF_VITEM) in xf-debug.h

2014-01-03 kent headley <headley@mbari.org>
* xf-gateway.c: 
  - moved code blocks to put related functions together
  - eliminated gateway data_handler accessor methods
  - added s_start_data_handler
* xf-dreactor.c:
  - made dreactor opaque
  - added transparent data handler stat struct (dhstat_t)
    in xf-dreactor.h for job stats tracking
  - replaced dreactor built-in queue management with xf-jobq 
  - eliminates several members
  - simplifies dreactor internals
  - reuse of jobq
* xf-jobq.c: 
  - eliminated inc_ methods
  - xfjq_post: removed thread-unsafe variables

2014-01-02 kent headley <headley@mbari.org>
* removing src/common directory

2014-01-02 kent headley <headley@mbari.org>
* Updating files moved from src/common to src/gateway/core
* note: botched commit/message 2013-12-18; this is part of that change
  and the full commit message appears below

2013-12-18 kent headley <headley@mbari.org>
* updated headers
  - moved declaration of types with circular dependencies to xf-types.h
  - commented both xf-types.h and header of origin to indicate where they
	belong
  - To prevent circular dependencies, xf-types.h does not include other 
    xfoce headers (except xf-debug.h)
  - all source files (.h,.c) include the minimum set of headers
  - xf-types.h is used to either for common project types, or for 
    declarations that would otherwise cause circular dependencies.
  - .h files should only include headers containing types used in the headers
  - .c files should include their associated .h and any headers not covered.
  - removed cruft (comments, redundancies, etc.)

* updated build
  - now build a single library (libxfoce)
  - defs still retained in original headers, using guards (e.g. XF_HEADER_NAME_SHARED),
	so they may be compiled independently
  - by convention, we include the relevant header(s), and include xf-types.h
    if needed to resolve circular dependencies
* moved src/common/* files to core
* deprecated singletons.h
* deprecated xfoce.h (created in last update)
* deprecated gateway.h
* changed the stream_id passed to lindex update (was record header, is data container)
* Update to gw-run.c (uses gw_start/stop, signal handing)
* Cleaned up some debug noise (hard-coded printfs in various modules)
* Changed xf-config debug output to print debug settings at a higher level
* added debug module XF_PSSERVER, XF_PROXSVR
* renamed debug module GATEWAY to XF_GATEWAY
* xf-debug uses fprintf(sdtderr) instead of printf
* gave dreactor it's own zmq context, and eliminated the shared message context from gateway
* added src/gateway/test/test-sig.c, a test program to validate concepts for signal handling and start/stop of multiple threads
* bug-fix shutdown sequence syslog race in testgw/gwrun (last couple of messages weren't making it into syslog
  when run outside of Valgrind)
* bug fix: added null/size check to args in xfbuf_append (TODO: check other functions)
* bug-fix: added mutex in xf_thread_start to prevent concurrent thread start
* bug-fix: replaced delay_msec() with macro that forces cast of argument to uint64_t. The missing cast produced a nasty 
		   bug: start up and shutdown were badly hosed on ARM, as an uncast arg would be interpreted as a 
		   valid but incorrect (e.g. very large) number.
* bug-fix: for threads that need to wait on a semaphore, now using separate static wait methods, instead of
           trying to share one and make it thread safe(how?).
* bumped version to 0.29

2013-12-18 kent headley <headley@mbari.org>
* Header and file fix-ups needed to make distribution build on Angstrom/beaglebone
  - An improvement, but still need to fix delicate build deps and clunky gaurd statements

2013-12-16 kent headley <headley@mbari.org>

* bumped version to 0.28

* ps-client.c
  - added help on available subtrees
  
* Implemented pubsub message topics in stream_process_info
  - changed pub_func API (eliminates need for gateway/handler reference
  
* Refactored data_process_rule
  - combined data_process_rule and data_process_info
  - made opaque
  - eliminated mtype and sdtopic (id types)
  - added pub_topic and post_topic (string types)
  - renamed data_process_rule -> sprule

* Refactored sdclient
  - made opaque
  - added start/stop methods (to start stop client in a worker thread)
  - added s_sdclient_action
  - renamed subtrees member -> topic
  - added necessary accessor methods
  
* Refactored sdata, source_id
  - made opaque
  - added necessary accessor methods

* Modified config files
  - sub_topic and pub_topic are free-form strings
  - strings are more flexible, simpler
  - eliminated sd_topic, mtype, lookup/parsing functions, proxy data items
  - stopped tracking some of the lesser used test config files

* Deprecated decl.c,h
  - moved relevant members to data.h,c and renamed
  - pubsub_subtree_id2str()
  - sdata_topic_id2str()

* Deprecated gateway.c,h
  - replaced with xf-gateway.c,h

* Modified shared data client update time
  - made less than (3s) clone/server timeout (5s)
  - prevents constant server fail over and resulting log messages

* Revised monotonicity warning condition in log.c
  - Fixes constant warnings about non-monotonic keys in logs
  - (it's OK to have duplicate timestamps if the streams are different)
  - Added kmax_source_id to index chunk header (icheader_t)
  - updated warning condition in index update function
  - compares key<=max_key && stream_id of max/current key
  

 
2013-12-10 kent headley <headley@mbari.org>

* Major refactor of gateway
  - completely opaque gateway
  - eliminated dependencies on gateway in independent modules (e.g. logger)
    (gateway references are passed or included in structs)
  - gateway no longer assumed to be single global instance per machine
  - eliminated several obsolete accessor methods
  - made function names and signatures consistent
  - made syslog and datalog gateway functions
  - eliminated global_thread_quit

* Made single xfoce.h header. All C modules optionally include a header
  of the same name, which includes xfoce.h

* data_container is fully opaque
  - added constructor dcon_xinew to replace package_data in driver.c
  - methods renamed with dcon_ prefix

* Eliminated Singletons

* Fixed Valgrind errors and leaks in all test code

* Config refactor
  - eliminated device_config_t
  - moved platform ID completely into config space as platform_config_t (removed from xfgw_t)
  - renamed gw_config_* gwcfg_*

* Removed redundant logging functions

* PUBSUB server (psserver)
  - now fully opaque, with start/stop methods
  - pub/sub server endpoint config now via config file
    - eliminated global, hard-coded values
    - added tcp_addr_tostring functions)

* Binary version string now automatically generated at compile time by autotools

* Much cruft removal throughout (unused/redundant variables, functions, etc.)