+ afb_req_fail_f(request, "query-params","params wrong or missing");
+ goto OnErrorExit;
+ }
+
+ if (json_object_get_type(json_object_object_get(j_obj, "i2c_data"))==json_type_array) {
+ int size = json_object_array_length(json_object_object_get(j_obj, "i2c_data"));
+ if ((size > 0) && (size <= UCSB_I2C_MAX_PAYLOAD)) {
+
+ int32_t i;
+ int32_t val;
+ struct json_object *j_elem;
+ struct json_object *j_arr = json_object_object_get(j_obj, "i2c_data");
+
+ for (i = 0; i < size; i++) {
+
+
+ j_elem = json_object_array_get_idx(j_arr, i);
+ val = json_object_get_int(j_elem);
+ if ((val < 0) && (val > 0xFF)){
+ i = 0;
+ break;
+ }
+ tx_payload[i] = (uint8_t)json_object_get_int(j_elem);
+ }
+
+ tx_payload_sz = (uint8_t)i;
+ }
+ }
+
+ if (tx_payload_sz == 0) {
+ AFB_NOTICE("i2c_data: invalid or not found");
+ afb_req_fail_f(request, "query-params","params wrong or missing");