Click here to Skip to main content
14,772,543 members
Home » Discussions » Linux Programming
   

Linux Programming

 
GeneralRe: Return indicates failure , errno indicates status? Pin
Richard MacCutchan6-Mar-20 22:42
mveRichard MacCutchan6-Mar-20 22:42 
GeneralRe: Return indicates failure , errno indicates status? Pin
k50547-Mar-20 5:55
mvek50547-Mar-20 5:55 
GeneralRe: Return indicates failure , errno indicates status? Pin
Vaclav_7-Mar-20 7:01
MemberVaclav_7-Mar-20 7:01 
GeneralRe: Return indicates failure , errno indicates status? Pin
Richard MacCutchan8-Mar-20 2:29
mveRichard MacCutchan8-Mar-20 2:29 
GeneralRe: Return indicates failure , errno indicates status? Pin
Member 1330167921-Dec-20 0:40
MemberMember 1330167921-Dec-20 0:40 
GeneralRe: Return indicates failure , errno indicates status? Pin
Richard MacCutchan21-Dec-20 0:48
mveRichard MacCutchan21-Dec-20 0:48 
AnswerRe: Return indicates failure , errno indicates status? Pin
Member 1330167921-Dec-20 0:40
MemberMember 1330167921-Dec-20 0:40 
QuestionUsing ba2str fails - why ? Pin
Vaclav_4-Mar-20 5:59
MemberVaclav_4-Mar-20 5:59 
This is pretty simple function and compiles and works fine on X86.
Same usage , with same parameters passed to it, fails on ARM.

Description Resource Path Location Type
cannot convert ‘sockaddr_rc’ to ‘char*’ for argument ‘2’ to ‘int ba2str(const bdaddr_t*, char*)’ CBT.cpp /RPI_BT_CLIENT_ARM_/src/MODULES/M_CBT line 286 C/C++ Problem

I am at lost and could use some help to make it work.

It it helps, here is the code

for (i = 0; i < num_rsp; i++) {
            // convert bdaddr to array addr for print
    ba2str(&(ii + i)->bdaddr, addr);  FAILS HERE
    memset(name, 0, sizeof(name));
    if (hci_read_remote_name(dev_descriptor, &(ii + i)->bdaddr,
            sizeof(name), name, 0) < 0)
        strcpy(name, "[unknown]");
    printf("remote address  %s  remote name  %s\n", addr, name);
}


Bluetooth addresses are a 6-byte hex number similar to an Ethernet MAC address. BlueZ provides convenience functions for converting between a 6-byte string in the format 00:11:22:33:44:55 and the bdaddr_t struct. Here are the function prototypes:

    int ba2str(const bdaddr_t *ba, char *str);
    int str2ba(const char *str, bdaddr_t *ba);

The function ba2str converts from the internal bdaddr_t to a zero-terminated string (the str parameter should have at least 18 bytes), and str2ba provides the opposite conversion. The first example makes use of the ba2str function. 

AnswerRe: Using ba2str fails - why ? Pin
ZurdoDev4-Mar-20 6:14
professionalZurdoDev4-Mar-20 6:14 
GeneralRe: Using ba2str fails - why ? Pin
Vaclav_4-Mar-20 6:36
MemberVaclav_4-Mar-20 6:36 
AnswerRe: Using ba2str fails - why ? Pin
ZurdoDev4-Mar-20 6:48
professionalZurdoDev4-Mar-20 6:48 
GeneralRe: Using ba2str fails - why ? Pin
k50544-Mar-20 6:54
mvek50544-Mar-20 6:54 
AnswerRe: Using ba2str fails - why ? Pin
k50544-Mar-20 6:20
mvek50544-Mar-20 6:20 
AnswerRe: Using ba2str fails - why ? Pin
Richard MacCutchan4-Mar-20 6:34
mveRichard MacCutchan4-Mar-20 6:34 
GeneralRe: Using ba2str fails - why ? Pin
Vaclav_4-Mar-20 6:46
MemberVaclav_4-Mar-20 6:46 
GeneralRe: Using ba2str fails - why ? Pin
Richard MacCutchan4-Mar-20 7:16
mveRichard MacCutchan4-Mar-20 7:16 
AnswerSOLVED Re: Using ba2str fails - why ? Pin
Vaclav_4-Mar-20 7:33
MemberVaclav_4-Mar-20 7:33 
QuestionCan "cast looses precision " error be optioned out ? Pin
Vaclav_3-Mar-20 5:10
MemberVaclav_3-Mar-20 5:10 
AnswerRe: Can "cast looses precision " error be optioned out ? Pin
Richard MacCutchan3-Mar-20 5:43
mveRichard MacCutchan3-Mar-20 5:43 
AnswerRe: Can "cast looses precision " error be optioned out ? Pin
Daniel Pfeffer3-Mar-20 5:52
professionalDaniel Pfeffer3-Mar-20 5:52 
GeneralMessage Closed Pin
9-Mar-20 15:21
Memberwatchmeoni9-Mar-20 15:21 
AnswerRe: Can "cast looses precision " error be optioned out ? Pin
k50543-Mar-20 6:52
mvek50543-Mar-20 6:52 
AnswerSOLVED Re: Can "cast looses precision " error be optioned out ? Pin
Vaclav_3-Mar-20 9:00
MemberVaclav_3-Mar-20 9:00 
GeneralRe: SOLVED Re: Can "cast looses precision " error be optioned out ? Pin
k50543-Mar-20 11:36
mvek50543-Mar-20 11:36 
GeneralRe: SOLVED Re: Can "cast looses precision " error be optioned out ? Pin
Vaclav_3-Mar-20 14:47
MemberVaclav_3-Mar-20 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.