本文整理汇总了C++中Osal_MemCpy函数的典型用法代码示例。如果您正苦于以下问题:C++ Osal_MemCpy函数的具体用法?C++ Osal_MemCpy怎么用?C++ Osal_MemCpy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Osal_MemCpy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aci_att_find_by_type_value_req
tBleStatus aci_att_find_by_type_value_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle,
uint8_t* uuid, uint8_t attr_val_len, uint8_t* attr_val)
{
struct hci_request rq;
uint8_t status;
att_find_by_type_value_req_cp cp;
if(attr_val_len > sizeof(cp.attr_val))
return BLE_STATUS_INVALID_PARAMS;
cp.conn_handle = htobs(conn_handle);
cp.start_handle = htobs(start_handle);
cp.end_handle = htobs(end_handle);
Osal_MemCpy(cp.uuid, uuid, 2);
cp.attr_val_len = attr_val_len;
Osal_MemCpy(cp.attr_val, attr_val, attr_val_len);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_ATT_FIND_BY_TYPE_VALUE_REQ;
rq.cparam = &cp;
rq.clen = ATT_FIND_BY_TYPE_VALUE_REQ_CP_SIZE + attr_val_len;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例2: aci_gap_resolve_private_address
tBleStatus aci_gap_resolve_private_address(const tBDAddr private_address, tBDAddr actual_address)
{
struct hci_request rq;
gap_resolve_private_address_cp cp;
gap_resolve_private_address_rp rp;
Osal_MemCpy(cp.address, private_address, 6);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GAP_RESOLVE_PRIVATE_ADDRESS;
rq.cparam = &cp;
rq.clen = sizeof(cp);
rq.rparam = &rp;
rq.rlen = sizeof(rp);
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
if(rp.status)
return rp.status;
Osal_MemCpy(actual_address, rp.address, sizeof(actual_address));
return 0;
}
示例3: hci_le_encrypt
int hci_le_encrypt(uint8_t key[16], uint8_t plaintextData[16], uint8_t encryptedData[16])
{
struct hci_request rq;
le_encrypt_cp params;
le_encrypt_rp resp;
Osal_MemSet(&resp, 0, sizeof(resp));
Osal_MemCpy(params.key, key, 16);
Osal_MemCpy(params.plaintext, plaintextData, 16);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_LE_CTL;
rq.ocf = OCF_LE_ENCRYPT;
rq.cparam = ¶ms;
rq.clen = LE_ENCRYPT_CP_SIZE;
rq.rparam = &resp;
rq.rlen = LE_ENCRYPT_RP_SIZE;
if (hci_send_req(&rq, FALSE) < 0){
return BLE_STATUS_TIMEOUT;
}
if (resp.status) {
return resp.status;
}
Osal_MemCpy(encryptedData, resp.encdata, 16);
return 0;
}
示例4: aci_gatt_include_service
tBleStatus aci_gatt_include_service(uint16_t service_handle, uint16_t included_start_handle,
uint16_t included_end_handle, uint8_t included_uuid_type,
const uint8_t* included_uuid, uint16_t *included_handle)
{
struct hci_request rq;
gatt_include_serv_rp resp;
uint8_t buffer[23];
uint8_t uuid_len;
uint8_t indx = 0;
service_handle = htobs(service_handle);
Osal_MemCpy(buffer, &service_handle, 2);
indx += 2;
included_start_handle = htobs(included_start_handle);
Osal_MemCpy(buffer+indx, &included_start_handle, 2);
indx += 2;
included_end_handle = htobs(included_end_handle);
Osal_MemCpy(buffer+indx, &included_end_handle, 2);
indx += 2;
if(included_uuid_type == UUID_TYPE_16){
uuid_len = 2;
} else {
uuid_len = 16;
}
buffer[indx] = included_uuid_type;
indx++;
Osal_MemCpy(buffer + indx, included_uuid, uuid_len);
indx += uuid_len;
Osal_MemSet(&resp, 0, sizeof(resp));
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_INCLUDE_SERV;
rq.cparam = (void *)buffer;
rq.clen = indx;
rq.rparam = &resp;
rq.rlen = GATT_INCLUDE_SERV_RP_SIZE;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
if (resp.status) {
return resp.status;
}
*included_handle = btohs(resp.handle);
return 0;
}
示例5: printDebugCharac
void printDebugCharac(uint8_t numCharac, uint8_t *charac)
{
uint8_t i, index, sizeElement, properties;
uint16_t value_handle, charac_handle, uuid_charac;
APPL_MESG_INFO(profiledbgfile,"**** Number of Charac of a Service: %d\r\n", numCharac);
index = 0;
for (i=0; i<numCharac; i++) {
if (charac[index] == 1) {
sizeElement = 8;
Osal_MemCpy(&uuid_charac, &charac[index+6], 2);
} else {
sizeElement = 22;
}
switch(uuid_charac) {
case CURRENT_TIME_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Current Time Characteristic found\r\n");
break;
case LOCAL_TIME_INFORMATION_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Local Time Information Characteristic found\r\n");
break;
case REFERENCE_TIME_INFORMATION_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Reference Time Information Characteristic found\r\n");
break;
case TIME_WITH_DST_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Time with DST Characteristic found\r\n");
break;
case TIME_UPDATE_CONTROL_POINT_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Time Update COntrol Point Characteristic found\r\n");
break;
case TIME_UPDATE_STATE_CHAR_UUID:
APPL_MESG_INFO(profiledbgfile,"**** Time Update State Characteristic found\r\n");
break;
default:
APPL_MESG_INFO(profiledbgfile,"**** Characteristic found\r\n");
break;
}
Osal_MemCpy(&charac_handle, &charac[index+1], 2);
properties = charac[index+3];
Osal_MemCpy(&value_handle, &charac[index+4], 2);
APPL_MESG_INFO(profiledbgfile,"**** Characteristic Handle = 0x%04x\r\n", charac_handle);
APPL_MESG_INFO(profiledbgfile,"**** Properties = 0x%02x\r\n", properties);
APPL_MESG_INFO(profiledbgfile,"**** ValueHandle = 0x%04x\r\n", value_handle);
APPL_MESG_INFO(profiledbgfile,"**** UUID = 0x%04x\r\n", uuid_charac);
index += sizeElement;
}
}
示例6: aci_gatt_write_response
tBleStatus aci_gatt_write_response(uint16_t conn_handle,
uint16_t attr_handle,
uint8_t write_status,
uint8_t err_code,
uint8_t att_val_len,
uint8_t *att_val)
{
struct hci_request rq;
uint8_t status;
uint8_t buffer[HCI_MAX_PAYLOAD_SIZE];
uint8_t indx = 0;
if ((att_val_len+7) > HCI_MAX_PAYLOAD_SIZE)
return BLE_STATUS_INVALID_PARAMS;
conn_handle = htobs(conn_handle);
Osal_MemCpy(buffer + indx, &conn_handle, 2);
indx += 2;
attr_handle = htobs(attr_handle);
Osal_MemCpy(buffer + indx, &attr_handle, 2);
indx += 2;
buffer[indx] = write_status;
indx += 1;
buffer[indx] = err_code;
indx += 1;
buffer[indx] = att_val_len;
indx += 1;
Osal_MemCpy(buffer + indx, att_val, att_val_len);
indx += att_val_len;
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_WRITE_RESPONSE;
rq.cparam = (void *)buffer;
rq.clen = indx;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
if (status) {
return status;
}
return 0;
}
示例7: aci_gatt_set_desc_value
tBleStatus aci_gatt_set_desc_value(uint16_t servHandle,
uint16_t charHandle,
uint16_t charDescHandle,
uint16_t charDescValOffset,
uint8_t charDescValueLen,
const uint8_t *charDescValue)
{
struct hci_request rq;
uint8_t status;
uint8_t buffer[HCI_MAX_PAYLOAD_SIZE];
uint8_t indx = 0;
if ((charDescValueLen+9) > HCI_MAX_PAYLOAD_SIZE)
return BLE_STATUS_INVALID_PARAMS;
servHandle = htobs(servHandle);
Osal_MemCpy(buffer + indx, &servHandle, 2);
indx += 2;
charHandle = htobs(charHandle);
Osal_MemCpy(buffer + indx, &charHandle, 2);
indx += 2;
charDescHandle = htobs(charDescHandle);
Osal_MemCpy(buffer + indx, &charDescHandle, 2);
indx += 2;
Osal_MemCpy(buffer + indx, &charDescValOffset, 2);
indx += 2;
buffer[indx] = charDescValueLen;
indx++;
Osal_MemCpy(buffer + indx, charDescValue, charDescValueLen);
indx += charDescValueLen;
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_SET_DESC_VAL;
rq.cparam = (void *)buffer;
rq.clen = indx;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例8: aci_gatt_disc_charac_by_uuid
tBleStatus aci_gatt_disc_charac_by_uuid(uint16_t conn_handle, uint16_t start_handle,
uint16_t end_handle, uint8_t charUuidType,
const uint8_t* charUuid)
{
struct hci_request rq;
uint8_t status;
uint8_t buffer[23];
uint8_t uuid_len;
uint8_t indx = 0;
conn_handle = htobs(conn_handle);
Osal_MemCpy(buffer + indx, &conn_handle, 2);
indx += 2;
start_handle = htobs(start_handle);
Osal_MemCpy(buffer + indx, &start_handle, 2);
indx += 2;
end_handle = htobs(end_handle);
Osal_MemCpy(buffer + indx, &end_handle, 2);
indx += 2;
buffer[indx] = charUuidType;
indx++;
if(charUuidType == 0x01){
uuid_len = 2;
}
else {
uuid_len = 16;
}
Osal_MemCpy(buffer + indx, charUuid, uuid_len);
indx += uuid_len;
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_DISC_CHARAC_BY_UUID;
rq.cparam = (void *)buffer;
rq.clen = indx;
rq.event = EVT_CMD_STATUS;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例9: aci_gap_start_general_conn_establish_proc_IDB04A1
tBleStatus aci_gap_start_general_conn_establish_proc_IDB04A1(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
uint8_t own_address_type, uint8_t filter_duplicates, uint8_t use_reconn_addr, const tBDAddr reconn_addr)
{
struct hci_request rq;
gap_start_general_conn_establish_proc_cp_IDB04A1 cp;
uint8_t status;
cp.scan_type = scan_type;
cp.scan_interval = htobs(scan_interval);
cp.scan_window = htobs(scan_window);
cp.own_address_type = own_address_type;
cp.filter_duplicates = filter_duplicates;
cp.use_reconn_addr = use_reconn_addr;
Osal_MemCpy(cp.reconn_addr, reconn_addr, 6);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GAP_START_GENERAL_CONN_ESTABLISH_PROC;
rq.cparam = &cp;
rq.clen = sizeof(cp);
rq.event = EVT_CMD_STATUS;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例10: aci_gap_set_direct_connectable
tBleStatus aci_gap_set_direct_connectable(uint8_t own_addr_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr)
#endif
{
struct hci_request rq;
gap_set_direct_conectable_cp cp;
uint8_t status;
cp.own_bdaddr_type = own_addr_type;
#if BLUENRG_MS
cp.directed_adv_type = directed_adv_type;
#endif
cp.direct_bdaddr_type = initiator_addr_type;
Osal_MemCpy(cp.direct_bdaddr, initiator_addr, 6);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GAP_SET_DIRECT_CONNECTABLE;
rq.cparam = &cp;
rq.clen = sizeof(cp);
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例11: aci_gatt_write_long_charac_val
tBleStatus aci_gatt_write_long_charac_val(uint16_t conn_handle, uint16_t attr_handle,
uint16_t val_offset, uint8_t val_len, const uint8_t* attr_val)
{
struct hci_request rq;
uint8_t status;
gatt_write_long_charac_val_cp cp;
if(val_len > sizeof(cp.attr_val))
return BLE_STATUS_INVALID_PARAMS;
cp.conn_handle = htobs(conn_handle);
cp.attr_handle = htobs(attr_handle);
cp.val_offset = htobs(val_offset);
cp.val_len = val_len;
Osal_MemCpy(cp.attr_val, attr_val, val_len);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_WRITE_LONG_CHARAC_VAL;
rq.cparam = &cp;
rq.clen = GATT_WRITE_LONG_CHARAC_VAL_CP_SIZE + val_len;
rq.event = EVT_CMD_STATUS;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例12: hci_read_bd_addr
int hci_read_bd_addr(tBDAddr bdaddr)
{
struct hci_request rq;
read_bd_addr_rp resp;
Osal_MemSet(&resp, 0, sizeof(resp));
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_INFO_PARAM;
rq.ocf = OCF_READ_BD_ADDR;
rq.cparam = NULL;
rq.clen = 0;
rq.rparam = &resp;
rq.rlen = READ_BD_ADDR_RP_SIZE;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
if (resp.status) {
return resp.status;
}
Osal_MemCpy(bdaddr, resp.bdaddr, sizeof(tBDAddr));
return 0;
}
示例13: hci_le_set_advertising_parameters
int hci_le_set_advertising_parameters(uint16_t min_interval, uint16_t max_interval, uint8_t advtype,
uint8_t own_bdaddr_type, uint8_t direct_bdaddr_type, const tBDAddr direct_bdaddr, uint8_t chan_map,
uint8_t filter)
{
struct hci_request rq;
le_set_adv_parameters_cp adv_cp;
uint8_t status;
Osal_MemSet(&adv_cp, 0, sizeof(adv_cp));
adv_cp.min_interval = min_interval;
adv_cp.max_interval = max_interval;
adv_cp.advtype = advtype;
adv_cp.own_bdaddr_type = own_bdaddr_type;
adv_cp.direct_bdaddr_type = direct_bdaddr_type;
Osal_MemCpy(adv_cp.direct_bdaddr,direct_bdaddr,sizeof(adv_cp.direct_bdaddr));
adv_cp.chan_map = chan_map;
adv_cp.filter = filter;
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_LE_CTL;
rq.ocf = OCF_LE_SET_ADV_PARAMETERS;
rq.cparam = &adv_cp;
rq.clen = LE_SET_ADV_PARAMETERS_CP_SIZE;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例14: aci_gatt_disc_prim_service_by_uuid
tBleStatus aci_gatt_disc_prim_service_by_uuid(uint16_t conn_handle, uint8_t uuid_type, uint8_t* uuid)
{
struct hci_request rq;
uint8_t status;
gatt_disc_prim_service_by_uuid_cp cp;
uint8_t uuid_len;
if(uuid_type == UUID_TYPE_16){
uuid_len = 2;
}
else{
uuid_len = 16;
}
cp.conn_handle = htobs(conn_handle);
cp.uuid_type = uuid_type;
Osal_MemCpy(cp.uuid, uuid, uuid_len);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_GATT_DISC_PRIM_SERVICE_BY_UUID;
rq.cparam = &cp;
rq.clen = GATT_DISC_PRIM_SERVICE_BY_UUID_CP_SIZE + uuid_len;
rq.event = EVT_CMD_STATUS;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}
示例15: aci_att_prepare_write_req
tBleStatus aci_att_prepare_write_req(uint16_t conn_handle, uint16_t attr_handle, uint16_t value_offset,
uint8_t attr_val_len, uint8_t* attr_val)
{
struct hci_request rq;
uint8_t status;
att_prepare_write_req_cp cp;
if(attr_val_len > sizeof(cp.attr_val))
return BLE_STATUS_INVALID_PARAMS;
cp.conn_handle = htobs(conn_handle);
cp.attr_handle = htobs(attr_handle);
cp.value_offset = htobs(value_offset);
cp.attr_val_len = attr_val_len;
Osal_MemCpy(cp.attr_val, attr_val, attr_val_len);
Osal_MemSet(&rq, 0, sizeof(rq));
rq.ogf = OGF_VENDOR_CMD;
rq.ocf = OCF_ATT_PREPARE_WRITE_REQ;
rq.cparam = &cp;
rq.clen = ATT_PREPARE_WRITE_REQ_CP_SIZE + attr_val_len;
rq.rparam = &status;
rq.rlen = 1;
if (hci_send_req(&rq, FALSE) < 0)
return BLE_STATUS_TIMEOUT;
return status;
}