diff --git a/cbc.schema.json b/cbc.schema.json index b33d0eb..cdaab38 100644 --- a/cbc.schema.json +++ b/cbc.schema.json @@ -38,7 +38,7 @@ "properties": { "cbe_name": { "type": "string" }, "category": { "$ref": "#/definitions/category" }, - "rep_period": { "$ref": "#/definitions/repetition_period" }, + "repetition_period": { "$ref": "#/definitions/repetition_period" }, "num_of_bcast": { "$ref": "#/definitions/number_of_broadcasts" }, "scope": { "$ref": "#/definitions/scope" }, "warning_period_sec": { "$ref": "#/definitions/warning_period_sec" }, diff --git a/src/cbc_data.h b/src/cbc_data.h index f24259d..b5956a7 100644 --- a/src/cbc_data.h +++ b/src/cbc_data.h @@ -132,7 +132,7 @@ struct cbc_message { const char *cbe_name; /* name of the CBE originating this SMSCB */ enum cbsp_category priority; - uint16_t rep_period; /* repetition period (1..4095) */ + uint16_t rep_period; /* repetition period (1..4095) in units of 1.883s */ bool extended_cbch; /* basic (false) or extended (true) CBCH */ uint32_t warning_period_sec; /* warning period in seconds (0xffffffff = unlimited) */ uint16_t num_bcast; /* number of broadcasts requested (0=unlimited) */ diff --git a/src/rest_api.c b/src/rest_api.c index c057690..47606b1 100644 --- a/src/rest_api.c +++ b/src/rest_api.c @@ -460,9 +460,15 @@ static int json2cbc_message(struct cbc_message *out, void *ctx, json_t *in, cons } /* Repetition Period (O) */ - jtmp = json_object_get(in, "repetition_period"); - if (jtmp) { - /* FIXME */ + rc = json_get_integer_range(&tmp, in, "repetition_period", 0, 4095); + if (rc == 0) + out->rep_period = tmp; + else if (rc == -ENOENT){ + *errstr = "CBCMSG 'repetiton_period' is mandatory"; + return rc; + } else { + *errstr = "CBCMSG 'repetiton_period' out of range"; + return rc; } /* Number of Broadcasts (O) */