From 25fce131f4e062b90f965972230aae2c6c2143f7 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Thu, 16 Feb 2023 14:34:51 +0200
Subject: [PATCH] Cleanups.

---
 coupler/cli.h    | 38 ++++++++++++++++++++------------------
 coupler/server.c |  4 ----
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/coupler/cli.h b/coupler/cli.h
index 834cca8..57873c8 100644
--- a/coupler/cli.h
+++ b/coupler/cli.h
@@ -6,24 +6,26 @@ const char *argp_program_bug_address = "info@nexedi.com";
 static char doc[] = "OPC-UA server which controls MOD-IO's relays' state over OPC-UA protocol.";
 static char args_doc[] = "...";
 static struct argp_option options[] = {
-  {"port",        'p', "4840", 0, "Port to bind to."},
-  {"server-ip-address",     'a', "", 0, "[not yet available] Server address to bind to."},
-  {"device",      'd', "/dev/i2c-1", 0, "Linux block device path."},
-  {"slave-address-list", 's', "0x58", 0, "Comma separated list of slave I2C addresses."},
-  {"mode",        'm', "0", 0, "Set different modes of operation of coupler. Default (0) is set attached \
-                  I2C's state state. Virtual (1) which does NOT set any I2C slaves' state."},
-  {"username",    'u', "", 0, "Username."},
-  {"password",    'w', "", 0, "Password."},
-  {"key",         'k', "", 0, "x509 key."},
-  {"certificate", 'c', "", 0, "X509 certificate."},
-  {"id",          'i', "0", 0, "ID of coupler."},
-  {"heart-beat",  'b', "0", 0, "Publish heart beat to other couplers."},
-  {"heart-beat-interval",  't', "500", 0, "Heart beat interval in ms."},
-  {"heart-beat-timeout-interval",  'o', "2000", 0, "Heart beat timeout interval in ms."},
-  {"heart-beat-id-list",  'l', "", 0, "Comma separated list of IDs of couplers to watch for heart beats. \
-                   If a heart beat is missing coupler goes to safe mode."},
-  {"network-address-url-data-type", 'n', "opc.udp://224.0.0.22:4840/", 0, "Network address URL type used for Pub/Sub."},
-  {"network-interface", 'j', "", 0, "Network interface to use for Pub/Sub."},
+  {"port",                  'p', "4840",       0, "Port to bind to."},
+  {"server-ip-address",     'a', "",           0, "[not yet available] Server address to bind to."},
+  {"device",                'd', "/dev/i2c-1", 0, "Linux block device path."},
+  {"slave-address-list",    's', "0x58",       0, "Comma separated list of slave I2C addresses."},
+  {"mode",                  'm', "0",          0, "Set different modes of operation of coupler. Default (0) is set attached \
+                                                   I2C's state state. Virtual (1) which does NOT set any I2C slaves' state."},
+  {"username",              'u', "",           0, "Username."},
+  {"password",              'w', "",           0, "Password."},
+  {"key",                   'k', "",           0, "x509 key."},
+  {"certificate",           'c', "",           0, "X509 certificate."},
+  {"id",                    'i', "0",          0, "ID of coupler."},
+  {"heart-beat",            'b', "0",          0, "Publish heart beat to other couplers."},
+  {"heart-beat-interval",   't', "500",        0, "Heart beat interval in ms."},
+  {"heart-beat-timeout-interval",
+                            'o', "2000",       0, "Heart beat timeout interval in ms."},
+  {"heart-beat-id-list",    'l', "",           0, "Comma separated list of IDs of couplers to watch for heart beats. \
+                                                   If a heart beat is missing coupler goes to safe mode."},
+  {"network-address-url-data-type",
+                            'n', "opc.udp://224.0.0.22:4840/", 0, "Network address URL type used for Pub/Sub."},
+  {"network-interface",     'j', "",           0, "Network interface to use for Pub/Sub."},
   {0}
 };
 
diff --git a/coupler/server.c b/coupler/server.c
index 020f190..b04fa78 100644
--- a/coupler/server.c
+++ b/coupler/server.c
@@ -6,10 +6,6 @@
  *   - i2c0.relay0..3
  *   - i2c0.in0..3
  *   - i2c0.ain0..3
- * Based on 
- *   https://www.kernel.org/doc/Documentation/i2c/dev-interface
- *   https://github.com/open62541/open62541/blob/master/examples/tutorial_server_variable.c
- *   https://stackoverflow.com/questions/9642732/parsing-command-line-arguments-in-c
  */
 
 #include <stdio.h>
-- 
2.30.9