Send/recieve data with Quectel Bt client and a device - bluetooth

Good morning.
I have a Quectel MC60 bt and a pulsioxymeter which has a service with two characteristics.
If I send the command “AA14EB00000000C6” to write charasteristic from my mobile, the pulsioxymeter responds me with the next general data.
Now I need to replicate exactly this but using Quectel MC60 Bt as client.
I have followed all the steps in the datasheet and I able to scan near devices, connect to my pulsioxymeter, list and check every services/feature, register to recieve notificacions and send the command to see the general data but in this point I don´t recieve data/notifications like in my mobile.
I add the secuence I´m using it.
AT+QBTGATCREG=1,“B001”
+QBTGATCREG: 1,0,“B001”
OK
AT+QBTGATCSCAN=1,“B001”
+QBTGATCSCAN: 1,0,“B001”
OK
+QBTGATCSCAN: “B001”,1681EFC323DB,74,02010604FF4EF3000C094F78796669742032313835
AT+QBTGATCSCAN=0,“B001”
+QBTGATCSCAN: 0,0,“B001”
OK
AT+QBTGATCCON=1,“B001”,1681EFC323DB,1
OK
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,1
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,2
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,3
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,4
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,5
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,6
+QBTGATCCON: 1,0,“B001”,1681EFC323DB,7
AT+QBTGATCSS=“B001”,1
OK
+QBTGATCSS: 0,“B001”,1,“0018”,0,1
+QBTGATCSS: 0,“B001”,1,“0118”,0,1
+QBTGATCSS: 0,“B001”,1,“59FE”,0,1
+QBTGATCSS: 0,“B001”,1,“0A18”,0,1
+QBTGATCSS: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1
AT+QBTGATCGC=“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1
OK
+QBTGATCGC: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“A3E1260AEE9AE9BBB0490BEBE7AC008B”,0,4
AT+QBTGATCGD=“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0
OK
+QBTGATCGD: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0,“0229”,0
AT+QBTGATCRN=1,“B001”,1681EFC323DB,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0
+QBTGATCRN: 1,1,“B001”,1681EFC323DB,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0
OK
AT+QBTGATCWD=“B001”,1,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0,“0229”,0,“0100”,0
OK
+QBTGATCWD: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0,“0229”,0
AT+QBTGATCRC=“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“A3E1260AEE9AE9BBB0490BEBE7AC008B”,0,0
OK
+QBTGATCRC: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“A3E1260AEE9AE9BBB0490BEBE7AC008B”,0,“AA”
AT+QBTGATCWC=“B001”,1,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“A3E1260AEE9AE9BBB0490BEBE7AC008B”,0,“C600000000EB14AA”,0
OK
+QBTGATCWC: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“A3E1260AEE9AE9BBB0490BEBE7AC008B”,0
AT+QBTGATCRD=“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0,“0229”,0,0
OK
+QBTGATCRD: 0,“B001”,1,“3923CF407316429A5C417E7DC49A8314”,0,1,“579A054352CDB1A61A4BE7A84A593407”,0,“0229”,0,“0000”
When i read the value of the descriptor it is “0000” when it should be “0100” that is the value that i wrote in the previous step.
I have tried to send the command to other characteristic, send other command, modify the secuence of at command, reverse the characters of command.
Thank you for your time and help.

Related

How use [optionalTrackingData] with viber-bot

I want to get some extra data from the user in my viber bot. This can be done via [optionalTrackingData]. But no matter how hard I try to send a message with [optionalTrackingData], the message from the user is always empty. Maybe there are some additional settings? I write on Node.js
this what I tried:
bot.sendMessage(response.userProfile, [
new TextMessage("please select your email:"),
keyboardMessage
], {'trackingData':'trackingData'});
please help
ok, I just reload mode.js and it start working

Kamailio 4.3.1 Register/200 OK asycnhornous

I am new to Kamailio 4.3.1 and I am trying to use it as described on this http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs page. Apparently it is a new approach to make asynchronous routing using NodeJS.
I've modified a little bit the example and adapted it with a REGISTER sip and it works quite good. But now I am looking for a way to make the things a little bit more complex.
In the example the NodeJS routine is called only when the REGISTER method has been received. I am trying to make a similar asynchronous call to NodeJS when the '200 OK' comes back from the REGISTERS's destination.
If we have:
Alice---REGISTER(Alice)---> Kamailio (async call to NodeJs)---REGISTER(Alice)-->Asterisk
Later when Asterisk accepts the REGISTER the I want to have this:
Alice<---200 OK---Kamailio(async call to NodeJS)<---200 OK---Asterisk
To catch the 200 OK, I configured Kamailio to execute an async call using EVAPI, like this:
request_route
{
....
route(REGISTRAR);
....
exit;
}
route[REGISTRAR]
{
...
t_on_reply("2OO_OK_RSP"); # Here I tell that I want to catch the "200 OK"
...
exit;
}
# When the 200 OK arrives, this code is called
onreply_route[2OO_OK_RSP]
{
# Here is my async call to NodeJS
evapi_async_relay("send message to NodeJS about 200 OK");
}
#When NodeJS returns
event_route[evapi:message-received]
{
if(200 OK)
{
t_countinue("..", "...", RSP_200OK)
}
}
route[RSP_200OK]
{
t_on_branch("MANAGE_BRANCH");
t_on_failure("MANAGE_FAILURE");
route(RELAY); # I am trying here to relay the 200 OK, which finishes by calling t_relay();
exit;
}
So this is my configuration which is treating the 200 OK. I would like to say that it works (because at the end the 200 Ok is relayed to Alice) BUT Kamailio logs this message:
tm [tm.c:1479]: _w_t_relay_to(): ERROR: w_t_relay_to: unsupported route type: 4
and I don't like this. I know that there is something wrong and when I am looking at the source code of Kamailio it is clear that this is not the right place to treat messages like "200 OK".
My question is, is there any other way (a good way) to relay/route the 200 OK, once the NodeJS has replied? I tried also with
t_reply("200","OK"); instead of t_relay();
But this generates a SIP message "200 OK" which does not contain everything that the messages received by Asterisk. Probably I can tell Kamailio to reply by exactly the same 200 OK, that it has just received?
Thank you in advance!
Best regards,
Anton
So finally I could find how to resolve partially my problem.
I discovered that the module EVAPI proposes a method called evapi_relay() which does not suspend the current transaction but sends a messages to the NodeJS application and relays the SIP messages immediately.
I says that this resolves my problem partially because however I am still not able to make the whole procedure with suspending the transaction (without the Kamailio error).
In my case, it is not so important, but I imagine that in some cases the problem will persist.
Anton
From EVAPI module documentation: After evapi_async_relay() returns true, no relaying should happen in request_route(), it should be followed by exit.
Relay the event data given as parameter to connected applications. Before evaluating the parameter, the request processing is suspended using tm module (using the t_suspend()/t_continue() framework). The routing of the SIP request can be continued once event_route[evapi:message-received] is triggered. After evapi_async_relay() returns true, no relaying should happen in request_route(), it should be followed by exit;.

poplib mark as seen

I am using poplib in Python 3.3 to fetch emails from a gmail account and everything is working well, except that the mails are not marked as read after retrieving them with the retr() method, despite the fact that the documentation says "Retrieve whole message number which, and set its seen flag."
Here is the code:
pop = poplib.POP3_SSL("pop.gmail.com", "995")
pop.user("recent:mymail#gmail.com")
pop.pass_("mypassword")
numMessages = len(pop.list()[1])
for i in range(numMessages):
for j in pop.retr(i+1)[1]:
print(j)
pop.quit()
Am I doing something wrong or does the documentation lie? (or, did I just misinterpret it?)
The POP protocol has no concept of "read" or "unread" messages; the LIST command simply shows all existing messages. You may want to use another protocol, like IMAP, if the server supports it.
You could delete messages after successful retrieval, using the DELE command. Only after a successful QUIT command will the server actually delete them.

Expect send KEY_DOWN and KEY_UP events to Process in Linux

I want to simulate embedded linux keypress events to my Qt GUI Application. Primarily I want to simulate KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, and KEY_F{1-2-3} key presses. I don't have X available.
There is an ASCII character table here:
http://foldoc.org/ASCII+character+table\
And I understand how to send things, say CNTRL-T, using that table to my aplication by spawning it and sending it the following in my expect script:
send "\x14"
I can't seem to find documentation or examples on how to send the KEY_??? key presses using Expect. How can I do this using Expect?
If not possible, is there some other way to send keypresses to my process? I can't seem to be able to echo escape sequences to /dev/input/keypad...
Update:
Thanks for the comments.
I can see the output that my arrow keys generate by doing:
$ od -c
^[[D^[[C^[[D^[[B^[[A^[[A^[[B^[[B^C
I can also see the output of infocmp xterm as:
am, bce, km, mc5i, mir, msgr, npc, xenl,
colors#8, cols#80, it#8, lines#24, pairs#64,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
ht=^I, hts=\EH, ich=\E[%p1%d#, il=\E[%p1%dL, il1=\E[L,
ind=^J, indn=\E[%p1%dS, invis=\E[8m,
is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=\177, kcbt=\E[Z,
kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf13=\EO2P, kf14=\EO2Q,
kf15=\EO2R, kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~,
kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P,
kf26=\EO5Q, kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~,
kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~,
kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~,
kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R,
kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~,
kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~,
kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P,
kf5=\E[15~, kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S,
kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~,
kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~,
kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\EO4P,
kf62=\EO4Q, kf63=\EO4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
khome=\EOH, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, memu=\Em,
op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rin=\E[%p1%dT,
rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l,
rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\Ec,
rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm,
setaf=\E[3%p1%dm,
setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;,
sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m,
tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c,
vpa=\E[%i%p1%dd,
I've tried several of the simple escape sequences on a 'menuconfig' ( much like Linux ) program for Buildroot like so:
#!/usr/bin/expect --
# Span menuconfig
spawn make menuconfig
expect *
send {"\e[D"}
#send {"\e[%p1%dB"}
interact
I'd like to have the menuconfig open and the cursor move down one spot. However, it just launches and quits right away, even though I have an 'interact' statement in there. Any ideas as to why? Thanks -
Have you tried using autoexpect ?
Try this :
$ autoexpect
And do what you want expect to do, if you would like it to scroll two lines down - send two down arrow events - do this by pressing down arrow twice.
Then exit autoexpect with Ctrl+C
Autoexpect will generate a script of all your actions that you can then run if you want expect to repeat the same thing. What is more important is that it will also catch the key events you want to send and generate correct lines of expect script that send these events. In my case (down arrow) this was
send -- "^[OB"
Just press all the keys you want to automatically send, and then inspect the generated script (usually named script.exp).
Hope this helps

calling a sip phone

im searching for a simple method to "ping" a sip:user#ip and get back a status like "available for call" , "busy" , "not connected" if the first two require to make his phone ring, thats ok
(optionally if necessary to call them to see the status then it was nice to include a senders number so that i can identify my server on the phone display when its checking the status or to play a short signal .wav in case someone takes up, so that they know what it was)
.....something like sipsak -x 1200 -C random#ownip -s sip:adressee#hisip -vvv...
gives me "406 Not Acceptable without Contact header"
i did not try anything else yet
i already wonder if the sending call still needs to be logged in at an isp then?
You're probably looking for the OPTIONS message. The reply to an OPTIONS does two things - first, it tells you the capabilities of the remote party and second, more importantly, the Status-Code returned is the Status-Code you would get if you'd sent an INVITE.
According to sipsak's documentation you're looking for this:
sipsak -vv -s sip:nobody#foo.bar
SIMPLE will work, but it may be overkill for what you want to do. See http://en.wikipedia.org/wiki/SIMPLE
Of course, not all SIP phones support SIMPLE.

Resources