微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > ANCS on iphone , details of message wanted

ANCS on iphone , details of message wanted

时间:10-02 整理:3721RD 点击:

in timeapp sample 

in ANCS section , how can i subscribe both Notification Source and Data Source  and obtain their callback ?
(https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html) 

Brief description: 

9FBF [notify characteristic ] - Notification Source
22EA[notify characteristic ] - Data Source
69D1 [write] - control point 


msg receive ->  9FBF notify with message ID, write command with message ID to 69D1, 22EA will callback the info of that msg

do it means i can get CCCD from both 9FBF , 22EA ?
 and i can start notify both by writing  a value of 0x0001 to the client characteristic configuration descriptor (CCCD). ?
( http://www.deyisupport.com/question_answer/wireless_connectivity/f/45/p/18256/61800.aspx )

i tried to search for CCCD , only can find CCCD in 0x9FBF,
so 0x22EA never  receive callback even i write value to 0x69D1
 

with reference to "timeapp_discover.c"

is the callback of both notify  arrive at  TimeAppDiscAlertNtf ?

jeff,

i can barely follow your description, if you can speak chinese, could you write it down in Chinese?

But some concepts i can tell you, ANS works differently with most other BLE services. 

for ANS, master side works as GATT server, slave works as GATT client, which is opposite from most other BLE services. That means, all the notifications have be to defined in the master side, in your case should be the iOS device. That also means, all the CCCDs are also defined on the master side. 

正在做一個ancs 在iphone 的測試 ,目標是知道有新訊息,和其內容,但我現在我只能取得新訊息的notifcation


看了http://mbientlab.com/blog/ancs-on-ti2541-in-an-afternoon/

iphone 的ancs characteristic 為

9FBF [notify characteristic ] - Notification Source
22EA[notify characteristic ] - Data Source
69D1 [write] - control point 

https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html

1. 當有訊息時,0x9FBF 會返回一個 notification callback ,callback 包合了 notification ID
2. 用notification ID write 到0x69D1
3. 成功的話,0x22EA 會收到 notification callback,會有全部關於這個message 的內容( sender,title,app id,content... )

我卡在3,因為不能起始0x22EA notify 或收到任何3的notification callback,

不知怎樣找0x22EA 的characteristic configuration (CCCD),也不知0x22EA 的notification callback 會到那兒,所以不知2 是否寫入正確資料
我只能成功找到0x9FBF 的cccd,用它的handler 成功取得 0x9FBF 的notification 

timeapp 只顯示怎樣取得一個notify characteristic , 如果我要同時起始 及 listen 兩個notify characteristic 就沒頭緒

jeff,

我了解了。

根据示例代码 https://github.com/lkasso/ANCS/blob/master/timeapp_discovery.c

理论上这个代码根据状态机应该能找到ANCS 下的所有characteristic,包括data source,然后再查找他们的CCCD,并且enable。

你能用C2540 dongle sniffer 抓下Log 分享给大家一下分析一下吗?

再重新測試了lkasso , timeapp_discovery.c
https://github.com/lkasso/ANCS/blob/master/timeapp_discovery.c

做了些改動, pMsg->msg.findInfoRsp.numInfo ( see remark #1 )  可以找到2 個 notification characteristic 

但只能找到1 個 characteristics 有CCCD ( remark #2 ) 

要用sniffer 試一下

 // Characteristic descriptors found

        if ( pMsg->method == ATT_FIND_INFO_RSP &&

             pMsg->msg.findInfoRsp.numInfo > 0 &&

             pMsg->msg.findInfoRsp.format == ATT_HANDLE_BT_UUID_TYPE )

        {

          // For each handle/uuid pair

          for ( i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++ )     //// remark #1

          {

            // Look for CCCD

            if ( (pMsg->msg.findInfoRsp.info.btPair[i].uuid[0] ==

                  LO_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) &&

                 (pMsg->msg.findInfoRsp.info.btPair[i].uuid[1] ==

                  HI_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) )

            {

              // CCCD found                           //// remark #2

              timeAppHdlCache[HDL_ANCS_NTF_CCCD] =

                pMsg->msg.findInfoRsp.info.btPair[i].handle;

              

              break;

            }

          }

        }

jeff,

至少找到一个CCCD了,好消息啊:)

pMsg->msg.findInfoRsp.numInfo 的值是多少呢?

这种情况最好还是sniffer 抓包看一下,是否所有的attribute 都查询到了。

numInfo  = 2

 只要write 0x0001到 data notification characteristics ( 0x7BFB ) , 就可以啟動 

callback 也是在 timeAppProcessGattMsg 取得

jeff,

你的意思是目前两个notification 都可以用了?

0x7BFB 是你找到的iOS的data source CCCD 的UUID?

是,

找出有characteristic descriptor (CCCD) 的characteristics,因為notify characteristics 才用會用到CCCD,共有兩個,取CCCD 的handler ,handler 數值比較小的是"Notification Source" , 用來通知有訊息到來, 大一點的是Data Source ,是用來收取message detail 的 callback

要起動這兩個 notification ,要用characteristic write ,寫0x0001 到這兩個CCCD handler,就能

在 timeAppProcessGattMsg ( timeapp.c ) 收到通知了

* 記得要先在iphone 移除之前的pairup

 attWriteReq_t writeReq;

  

  writeReq.handle = cccd1;    // or cccd2

  writeReq.len = 2;

  writeReq.value[0] = 0x01;

  writeReq.value[1] = 0x00;

  GATT_WriteCharValue(connHandle, &writeReq, taskId );

jeff,

非常感谢你的分享 :)

jeff你好

我已经使能了 Notification Source,Data Source。Notification Source会自动通知来电、短信。但是Data Source不会通知来电、短信的具体消息。

我是还需要NotificationUID吗?(因为需要它来作为handle去获取关于此notification的更多信息,例如来显通知,就需要这个通知中的NotificationUID作为handle,去查询是哪个号码打来,是哪个联系人等。)

// Characteristic descriptors found
if ( pMsg->method == ATT_FIND_INFO_RSP &&
pMsg->msg.findInfoRsp.numInfo > 0 &&
pMsg->msg.findInfoRsp.format == ATT_HANDLE_BT_UUID_TYPE )
{
// For each handle/uuid pair
for ( i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++ )
{
// Look for CCCD
if ( (pMsg->msg.findInfoRsp.info.btPair[i].uuid[0] ==
LO_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) &&
(pMsg->msg.findInfoRsp.info.btPair[i].uuid[1] ==
HI_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) )
{
// CCCD found
timeAppHdlCache[HDL_ANCS_DATA_SOURCE_CCCD] =
pMsg->msg.findInfoRsp.info.btPair[i].handle;

break;
}
}
}

writeReq.len = 2;

writeReq.value[0] = LO_UINT16(GATT_CLIENT_CFG_NOTIFY);
writeReq.value[1] = HI_UINT16(GATT_CLIENT_CFG_NOTIFY);
writeReq.sig = 0;
writeReq.cmd = 0;
writeReq.handle = timeAppHdlCache[HDL_ANCS_DATA_SOURCE_CCCD];
GATT_WriteCharValue( timeAppConnHandle, &writeReq, timeAppTaskId );

NotificationUID写到Control Point,我写后Data Source还是不会通知。

void timeAppIndGattMsg( gattMsgEvent_t *pMsg )
{
unsigned char i = 0;
if ( pMsg->msg.handleValueNoti.handle == 15 )
{
attWriteReq_t writeReq;

writeReq.len = 4;
writeReq.value[0] = pMsg->msg.handleValueNoti.value[4];
writeReq.value[1] = pMsg->msg.handleValueNoti.value[5];
writeReq.value[2] = pMsg->msg.handleValueNoti.value[6];
writeReq.value[3] = pMsg->msg.handleValueNoti.value[7];
writeReq.sig = 0;
writeReq.cmd = 1;
writeReq.handle = 12;
GATT_WriteNoRsp( timeAppConnHandle, &writeReq );
}

if ( pMsg->msg.handleValueNoti.handle == 18 )
{
i++;
}

HI Jeff,

你已经成功获取通知内容了吗?

 

很好,学习!

你好,我现在也在研究ancs,不知道怎么获取短信内容,我qq是920052390,可以向你请教一下吗

// Characteristic descriptors found
if ( pMsg->method == ATT_FIND_INFO_RSP &&
pMsg->msg.findInfoRsp.numInfo > 0 &&
pMsg->msg.findInfoRsp.format == ATT_HANDLE_BT_UUID_TYPE )
{
// For each handle/uuid pair
for ( i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++ )
{
// Look for CCCD
if ( (pMsg->msg.findInfoRsp.info.btPair[i].uuid[0] ==
LO_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) &&
(pMsg->msg.findInfoRsp.info.btPair[i].uuid[1] ==
HI_UINT16(GATT_CHAR_EXT_PROPS_UUID)) )
{
// CCCD found
// 找到CCCD后使能
timeAppHdlCache[HDL_ANCS_NTF_CCCD] =
pMsg->msg.findInfoRsp.info.btPair[i].handle;
LCD_WRITE_STRING_VALUE("cccd:", pMsg->msg.findInfoRsp.info.btPair[i].handle, 16, HAL_LCD_LINE_6);
newState = DISC_IDLE;
break;
}
}
}

我在这里打印的cccd是13, 你说的那两个cccd的handle是在这里获取吗?我怎么获取到两个cccd的handle呢?

HDL_ANCS_DATA_SOURCE_CCCD 请问你的这个宏定义是多少啊

你的这里// CCCD found
timeAppHdlCache[HDL_ANCS_DATA_SOURCE_CCCD] =
pMsg->msg.findInfoRsp.info.btPair[i].handle;

这个handle是多少呢?我要怎么设置我的HDL_ANCS_DATA_SOURCE_CCCD

dear jeff 

You can share your code?Many people are stuck here  OR can you tell Where did you give cccd1  cccd2  assignment

you error  HI_UINT16(GATT_CHAR_EXT_PROPS_UUID)) )

correct  

            if ( (pMsg->msg.findInfoRsp.info.btPair[i].uuid[0] ==
                  LO_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) &&
                 (pMsg->msg.findInfoRsp.info.btPair[i].uuid[1] ==
                  HI_UINT16(GATT_CLIENT_CHAR_CFG_UUID)) )

问题已解,有偿提供代码和技术支持 qq:  674823479

ANCS 当有来电时,能够接受到号码或者联系人名字。当iOS手机通讯录里保存了号码,只能接收到名字编码,没有保存号码,就接受到号码信息。请问一下,当iOS手机通讯录保存了名字,怎么接收到来电号码,而不是名字编码。

你好   我最近想在CC2640上做ANCS功能,由于FLASH空间限制之前我们把协议栈的BOND和SNV都屏蔽掉了,但是ANCS又需要用到BOND。

所以想请教一下:ANCS功能是否可以不使用BOND实现呢? 我在网上看到有篇文章说可以通过广播特定的数据不需要绑定。 具体怎么做不知道,这个特定的数据到底是什么数据? 你是否知道?

 谢谢

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top