本文整理汇总了C++中dbus_send函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_send函数的具体用法?C++ dbus_send怎么用?C++ dbus_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ti85_send_VAR
/* Variable (std var header: NUL padded, variable length) */
int ti85_send_VAR(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname)
{
uint8_t buffer[16];
char trans[17];
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
ticalcs_info(" PC->TI: VAR (size=0x%04X, id=%02X, name=%s)",
varsize, vartype, trans);
if (vartype != TI8586_BKUP)
{ // backup: special header
buffer[3] = strlen(varname);
memcpy(buffer + 4, varname, 8);
TRYF(dbus_send(handle, PC_TI8586, CMD_VAR, 4 + strlen(varname), buffer));
}
else
{
memcpy(buffer + 3, varname, 6);
TRYF(dbus_send(handle, PC_TI8586, CMD_VAR, 9, buffer));
}
return 0;
}
示例2: ti73_send_VAR_h
/* Variable (std var header: NUL padded, fixed length) */
int ti73_send_VAR_h(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname, uint8_t varattr)
{
uint8_t buffer[16];
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
memcpy(buffer + 3, varname, 8);
buffer[11] = 0x00;
buffer[12] = (varattr == ATTRB_ARCHIVED) ? 0x80 : 0x00;
ticalcs_info(" PC->TI: VAR (size=0x%04X, id=%02X, name=%s, attr=%i)",
varsize, vartype, varname, varattr);
if (vartype != TI7383_BKUP)
{ // backup: special header
pad_buffer(buffer + 3, '\0');
TRYF(dbus_send(handle, PC_TI7383, CMD_VAR, 11 + EXTRAS, buffer));
}
else
{
TRYF(dbus_send(handle, PC_TI7383, CMD_VAR, 9, buffer));
}
return 0;
}
示例3: ti82_send_VAR_h
/* Variable (std var header: NUL padded, fixed length) */
int ti82_send_VAR_h(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname)
{
uint8_t buffer[16];
char trans[17];
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
memcpy(buffer + 3, varname, 8);
ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
ticalcs_info(" PC->TI: VAR (size=0x%04X=%i, id=%02X, name=%s)",
varsize, varsize, vartype, trans);
if (vartype != TI8283_BKUP)
{
// backup: special header
pad_buffer(buffer + 3, '\0');
TRYF(dbus_send(handle, PC_TI8283, CMD_VAR, 11, buffer));
}
else
{
TRYF(dbus_send(handle, PC_TI8283, CMD_VAR, 9, buffer));
}
return 0;
}
示例4: ti85_send_REQ
/* Variable request (var header: NUL padded, fixed length) */
int ti85_send_REQ(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname)
{
uint8_t buffer[16] = { 0 };
char trans[9];
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
buffer[3] = strlen(varname);
memcpy(buffer + 4, varname, 8);
ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
ticalcs_info(" PC->TI: REQ (size=0x%04X, id=%02X, name=%s)",
varsize, vartype, trans);
if ((handle->model == CALC_TI86) && (vartype >= TI86_DIR) && (vartype <= TI86_ZRCL))
{
memset(buffer, 0, 9);
buffer[2] = vartype;
TRYF(dbus_send(handle, PC_TI86, CMD_REQ, 5, buffer));
}
else if((handle->model == CALC_TI86) && (vartype == TI86_BKUP))
{
memset(buffer, 0, 12);
buffer[2] = vartype;
TRYF(dbus_send(handle, PC_TI86, CMD_REQ, 11, buffer));
}
else
{
pad_buffer_to_8_chars(buffer + 4, '\0');
TRYF(dbus_send(handle, PC_TI8586, CMD_REQ, 4 + strlen(varname), buffer));
}
return 0;
}
示例5: ti73_send_REQ_h
/* Request variable (std var header: NUL padded, fixed length) */
int ti73_send_REQ_h(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname,
uint8_t varattr)
{
uint8_t buffer[16] = { 0 };
char trans[17];
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
memcpy(buffer + 3, varname, 8);
pad_buffer(buffer + 3, '\0');
buffer[11] = 0x00;
buffer[12] = (varattr == ATTRB_ARCHIVED) ? 0x80 : 0x00;
ticonv_varname_to_utf8_s(handle->model, varname, trans, vartype);
ticalcs_info(" PC->TI: REQ (size=0x%04X, id=%02X, name=%s, attr=%i)",
varsize, vartype, trans, varattr);
if (vartype != TI83p_IDLIST && vartype != TI83p_GETCERT)
{
TRYF(dbus_send(handle, PC_TI7383, CMD_REQ, 11 + EXTRAS, buffer));
}
else if(vartype != TI83p_GETCERT && handle->model != CALC_TI73)
{
TRYF(dbus_send(handle, PC_TI7383, CMD_REQ, 11, buffer));
}
else
{
TRYF(dbus_send(handle, PC_TI73, CMD_REQ, 3, buffer));
}
return 0;
}
示例6: ti73_send_VAR
/* Variable (std var header: NUL padded, fixed length) */
TIEXPORT3 int TICALL ti73_send_VAR(CalcHandle* handle, uint16_t varsize, uint8_t vartype, const char *varname, uint8_t varattr)
{
uint8_t buffer[16];
if (varname == NULL)
{
ticalcs_critical("%s: varname is NULL", __FUNCTION__);
return ERR_INVALID_PACKET;
}
buffer[0] = LSB(varsize);
buffer[1] = MSB(varsize);
buffer[2] = vartype;
memcpy(buffer + 3, varname, 8);
buffer[11] = 0x00;
buffer[12] = (varattr == ATTRB_ARCHIVED) ? 0x80 : 0x00;
ticalcs_info(" PC->TI: VAR (size=0x%04X, id=%02X, name=%s, attr=%i)", varsize, vartype, varname, varattr);
if (vartype != TI7383_BKUP)
{
// backup: special header
pad_buffer_to_8_chars(buffer + 3, '\0');
TRYF(dbus_send(handle, PC_TI7383, CMD_VAR, 11 + EXTRAS, buffer));
}
else
{
TRYF(dbus_send(handle, PC_TI7383, CMD_VAR, 9, buffer));
}
return 0;
}
示例7: ti73_send_SKP
/*
Skip variable
- rej_code [in]: a rejection code
- int [out]: an error code
*/
TIEXPORT3 int TICALL ti73_send_SKP(CalcHandle* handle, uint8_t rej_code)
{
TRYF(dbus_send(handle, PC_TI7383, CMD_SKP, 1, &rej_code));
ticalcs_info(" PC->TI: SKP (rejection code = %i)", rej_code);
return 0;
}
示例8: ti73_send_ERR_h
int ti73_send_ERR_h(CalcHandle* handle)
{
ticalcs_info(" PC->TI: ERR");
TRYF(dbus_send(handle, PC_TI7383, CMD_ERR, 2, NULL));
return 0;
}
示例9: ti82_send_EOT_h
int ti82_send_EOT_h(CalcHandle* handle)
{
ticalcs_info(" PC->TI: EOT");
TRYF(dbus_send(handle, PC_TI8283, CMD_EOT, 2, NULL));
return 0;
}
示例10: ti89_send_RTS
TIEXPORT3 int TICALL ti89_send_RTS(CalcHandle* handle, uint32_t varsize, uint8_t vartype, const char *varname)
{
uint8_t buffer[32];
uint16_t len;
VALIDATE_HANDLE(handle);
VALIDATE_NONNULL(varname);
len = (uint16_t)strlen(varname);
if (len > 17)
{
ticalcs_critical("Oversized variable name has length %i, clamping to 17", len);
len = 17;
}
buffer[0] = LSB(LSW(varsize));
buffer[1] = MSB(LSW(varsize));
buffer[2] = LSB(MSW(varsize));
buffer[3] = MSB(MSW(varsize));
buffer[4] = vartype;
buffer[5] = len;
memcpy(buffer + 6, varname, len);
buffer[6 + len] = 0x00;
len += 6 + 1;
// used by AMS <= 2.09 ?
//if ((vartype == TI89_AMS) || (vartype == TI89_APPL)) len--;
ticalcs_info(" PC->TI: RTS (size=0x%08X=%i, id=%02X, name=%s)", varsize, varsize, vartype, varname);
return dbus_send(handle, ti68k_handle_to_dbus_mid(handle), DBUS_CMD_RTS, len, buffer);
}
示例11: ti89_send_XDP_h
int ti89_send_XDP_h(CalcHandle* handle, uint32_t length, uint8_t * data)
{
ticalcs_info(" PC->TI: XDP (0x%04X = %i)", length, length);
TRYF(dbus_send(handle, PC_TI9X, CMD_XDP, length, data));
return 0;
}
示例12: ti85_send_ERR
int ti85_send_ERR(CalcHandle* handle)
{
ticalcs_info(" PC->TI: ERR");
TRYF(dbus_send(handle, PC_TI8586, CMD_ERR, 2, NULL));
return 0;
}
示例13: ti68k_send_VAR
TIEXPORT3 int TICALL ti68k_send_VAR(CalcHandle* handle, uint32_t varsize, uint8_t vartype, const char *varname, uint8_t target)
{
uint8_t buffer[32];
char trans[127];
uint8_t extra = (target == DBUS_MID_PC_TI92) ? 0 : ((vartype == TI89_BKUP) ? 0 : 1);
uint16_t len;
VALIDATE_HANDLE(handle);
VALIDATE_NONNULL(varname);
len = (uint16_t)strlen(varname);
if (len > 17)
{
ticalcs_critical("Oversized variable name has length %i, clamping to 17", len);
len = 17;
}
ticonv_varname_to_utf8_sn(handle->model, varname, trans, sizeof(trans), vartype);
buffer[0] = LSB(LSW(varsize));
buffer[1] = MSB(LSW(varsize));
buffer[2] = LSB(MSW(varsize));
buffer[3] = MSB(MSW(varsize));
buffer[4] = vartype;
buffer[5] = len;
memcpy(buffer + 6, varname, len);
buffer[6 + len] = 0x03;
ticalcs_info(" PC->TI: VAR (size=0x%08X=%i, id=%02X, name=%s)", varsize, varsize, vartype, trans);
return dbus_send(handle, target, DBUS_CMD_VAR, 6 + len + extra, buffer);
}
示例14: ti68k_send_simple_cmd
static inline int ti68k_send_simple_cmd(CalcHandle * handle, uint8_t target, uint8_t cmd, const char * cmdname, uint16_t length, const uint8_t* data)
{
VALIDATE_HANDLE(handle);
ticalcs_info(" PC->TI: %s", cmdname);
return dbus_send(handle, target, cmd, length, data);
}
示例15: ti89_send_DEL
TIEXPORT3 int TICALL ti89_send_DEL(CalcHandle* handle, uint32_t varsize, uint8_t vartype, const char *varname)
{
uint8_t buffer[32];
uint16_t len;
VALIDATE_HANDLE(handle);
VALIDATE_NONNULL(varname);
len = (uint16_t)strlen(varname);
if (len > 17)
{
ticalcs_critical("Oversized variable name has length %i, clamping to 17", len);
len = 17;
}
buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0;
buffer[3] = 0;
buffer[4] = 0;
buffer[5] = len;
memcpy(buffer + 6, varname, len);
ticalcs_info(" PC->TI: DEL (size=0x%08X=%i, id=%02X, name=%s)", varsize, varsize, vartype, varname);
return dbus_send(handle, ti68k_handle_to_dbus_mid(handle), DBUS_CMD_DEL, 6 + len, buffer);
}