diff options
author | Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> | 2017-01-12 09:03:16 -0500 |
---|---|---|
committer | Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> | 2017-01-12 09:18:21 -0500 |
commit | d2683360d190d0cdaa87d66da20780f05bb49c2e (patch) | |
tree | 3e7bbbb83ec826bd9f5a22ff21dd4491e67464f4 | |
parent | 7d5edde4ee7c38fcf2719ed9e4258fd497c8b51e (diff) |
LC15: Generation of BTS state file
Change-Id: I3fc76bdef552783f3d3dfa8c920465e248384eb3
-rw-r--r-- | src/osmo-bts-litecell15/main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/osmo-bts-litecell15/main.c b/src/osmo-bts-litecell15/main.c index a74da8a4..108ee478 100644 --- a/src/osmo-bts-litecell15/main.c +++ b/src/osmo-bts-litecell15/main.c @@ -51,6 +51,25 @@ #include <osmo-bts/pcu_if.h> #include <osmo-bts/l1sap.h> +static int write_status_file(char *status_file, char *status_str) +{ + FILE *outf; + char tmp[PATH_MAX+1]; + + snprintf(tmp, sizeof(tmp)-1, "/var/run/osmo-bts/%s", status_file); + tmp[PATH_MAX-1] = '\0'; + + outf = fopen(tmp, "w"); + if (!outf) + return -1; + + fprintf(outf, "%s\n", status_str); + + fclose(outf); + + return 0; +} + /*NTQD: Change how rx_nr is handle in multi-trx*/ #define LC15BTS_RF_LOCK_PATH "/var/lock/bts_rf_lock" @@ -107,6 +126,9 @@ void bts_model_phy_instance_set_defaults(struct phy_instance *pinst) int bts_model_oml_estab(struct gsm_bts *bts) { + /* update status file */ + write_status_file("state", ""); + return 0; } @@ -205,11 +227,17 @@ int bts_model_handle_options(int argc, char **argv) void bts_model_abis_close(struct gsm_bts *bts) { + /* write to status file */ + write_status_file("state", "ABIS DOWN"); + /* for now, we simply terminate the program and re-spawn */ bts_shutdown(bts, "Abis close"); } int main(int argc, char **argv) { + /* create status file with initial state */ + write_status_file("state", "ABIS DOWN"); + return bts_main(argc, argv); } |