mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-05 21:59:45 +00:00
check if message port is still valid and renew if not
This commit is contained in:
parent
7ec5eeaa74
commit
89007ccea2
@ -43,10 +43,17 @@
|
||||
static CFMessagePortRef springBoardAccessMessagePort = 0;
|
||||
|
||||
static int SBA_sendMessage(UInt8 cmd, UInt16 dataLen, UInt8 *data, CFDataRef *resultData){
|
||||
// check for port
|
||||
|
||||
// still valid
|
||||
if (springBoardAccessMessagePort && !CFMessagePortIsValid(springBoardAccessMessagePort)){
|
||||
CFRelease(springBoardAccessMessagePort);
|
||||
springBoardAccessMessagePort = NULL;
|
||||
}
|
||||
// create new one
|
||||
if (!springBoardAccessMessagePort) {
|
||||
springBoardAccessMessagePort = CFMessagePortCreateRemote(NULL, CFSTR(SBA_MessagePortName));
|
||||
}
|
||||
// well, won't work
|
||||
if (!springBoardAccessMessagePort) {
|
||||
return kCFMessagePortIsInvalid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user