static void iotjs_blehcisocket_destroy(THIS) {
  iotjs_blehcisocket_close(blehcisocket);

  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_blehcisocket_t, blehcisocket);
  iotjs_jobjectwrap_destroy(&_this->jobjectwrap);
  IOTJS_RELEASE(blehcisocket);
}
Example #2
0
void iotjs_https_poll_destroy(iotjs_https_poll_t* poll_data) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_https_poll_t, poll_data);
  if (_this->next != NULL) {
    iotjs_https_poll_destroy(_this->next);
  }
  IOTJS_RELEASE(poll_data);
}
void iotjs_uart_destroy_platform_data(
    iotjs_uart_platform_data_t* platform_data) {
  IOTJS_ASSERT(platform_data);

  iotjs_string_destroy(&platform_data->device_path);
  IOTJS_RELEASE(platform_data);
}
Example #4
0
static void iotjs_pwm_destroy(iotjs_pwm_t* pwm) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_pwm_t, pwm);
  iotjs_jobjectwrap_destroy(&_this->jobjectwrap);
#if defined(__linux__)
  iotjs_string_destroy(&_this->device);
#endif
  IOTJS_RELEASE(pwm);
}
Example #5
0
static void iotjs_bufferwrap_destroy(iotjs_bufferwrap_t* bufferwrap) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_bufferwrap_t, bufferwrap);
  if (_this->buffer != NULL) {
    iotjs_buffer_release(_this->buffer);
  }
  iotjs_jobjectwrap_destroy(&_this->jobjectwrap);
  IOTJS_RELEASE(bufferwrap);
}
Example #6
0
static void bridge_native_async_handler(uv_async_t* handle) {
  DDDLOG("%s\n", __func__);
  iotjs_call_jfunc_t* data = (iotjs_call_jfunc_t*)handle->data;

  bool result;
  iotjs_string_t output;

  result = bridge_native_call(IOTJS_MAGIC_STRING_TIZEN, data->fn_name,
                              data->message, &output);

  if (data->cb) {
    data->cb((int)!result, iotjs_string_data(&output));
  }

  iotjs_string_destroy(&output);

  // release
  uv_close((uv_handle_t*)&data->async, NULL);
  IOTJS_RELEASE(data->module);
  IOTJS_RELEASE(data->fn_name);
  IOTJS_RELEASE(data->message);
  IOTJS_RELEASE(data);
}
bool iotjs_i2c_write(iotjs_i2c_t* i2c) {
  I2C_METHOD_HEADER(i2c);

  uint8_t len = i2c->buf_len;
  IOTJS_ASSERT(len > 0);
  uint8_t* data = (uint8_t*)i2c->buf_data;

  int ret = iotbus_i2c_write(platform_data->i2c_context, data, len);

  IOTJS_RELEASE(i2c->buf_data);

  if (ret < 0) {
    DLOG("%s: cannot write data", __func__);
    return false;
  }
  return true;
}
Example #8
0
static void iotjs_adc_destroy(iotjs_adc_t* adc) {
  iotjs_adc_destroy_platform_data(adc->platform_data);
  IOTJS_RELEASE(adc);
}
Example #9
0
static void iotjs_gpio_destroy(iotjs_gpio_t* gpio) {
  iotjs_gpio_destroy_platform_data(gpio->platform_data);
  IOTJS_RELEASE(gpio);
}
Example #10
0
static void iotjs_tcpwrap_destroy(iotjs_tcpwrap_t* tcpwrap) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_tcpwrap_t, tcpwrap);
  iotjs_handlewrap_destroy(&_this->handlewrap);
  IOTJS_RELEASE(tcpwrap);
}
Example #11
0
void iotjs_adc_destroy_platform_data(iotjs_adc_platform_data_t* platform_data) {
  IOTJS_RELEASE(platform_data);
}
Example #12
0
// Destructor
void iotjs_https_destroy(iotjs_https_t* https_data) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_https_t, https_data);
  // To shutup unused variable _this warning
  _this->URL = NULL;
  IOTJS_RELEASE(https_data);
}
Example #13
0
void iotjs_i2c_destroy_platform_data(iotjs_i2c_platform_data_t* platform_data) {
  IOTJS_ASSERT(platform_data);
  IOTJS_RELEASE(platform_data);
}
Example #14
0
static void iotjs_blehcisocket_destroy(iotjs_blehcisocket_t* blehcisocket) {
  iotjs_blehcisocket_close(blehcisocket);
  IOTJS_RELEASE(blehcisocket);
}
Example #15
0
static void iotjs_spi_destroy(iotjs_spi_t* spi) {
  iotjs_spi_destroy_platform_data(spi->platform_data);
  IOTJS_RELEASE(spi);
}
Example #16
0
void iotjs_spi_destroy_platform_data(iotjs_spi_platform_data_t* pdata) {
  IOTJS_RELEASE(pdata);
}
Example #17
0
static void iotjs_spi_reqwrap_destroy(THIS) {
  IOTJS_VALIDATED_STRUCT_DESTRUCTOR(iotjs_spi_reqwrap_t, spi_reqwrap);
  iotjs_reqwrap_destroy(&_this->reqwrap);
  IOTJS_RELEASE(spi_reqwrap);
}
Example #18
0
static void iotjs_fs_reqwrap_destroy(iotjs_fs_reqwrap_t* fs_reqwrap) {
  uv_fs_req_cleanup(&fs_reqwrap->req);
  iotjs_reqwrap_destroy(&fs_reqwrap->reqwrap);
  IOTJS_RELEASE(fs_reqwrap);
}