Community Translation - Extracting the Length of Characteristic Value in Long Write – KBA223087

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HiOm_1802421
Level 5
Level 5
Distributor - Marubun (Japan)
50 replies posted 50 questions asked 25 replies posted

Hi,

I tried to translate this KBA223087 into Japanese.

Extracting the Length of Characteristic Value in Long Write – KBA223087

==========

タイトル:ロングライトの特性値の長さの抽出

質問:

特性(キャラクタリスティック)値がMTUサイズより長い場合に、どうやってクライアントからサーバに書き込まれた特性値の長さを抽出すれば良いですか。

回答:

書き込まれた特性値の長さがMTUサイズより大きい場合、サーバ側でCYBLE_EVT_GATTS_EXEC_WRITE_REQイベントが生成されます。

イベントパラメータは、CYBLE_GATTS_EXEC_WRITE_REQ_T構造体へのポインタです。

CYBLE_GATTS_EXEC_WRITE_REQ_T構造体では、prepwritecount個のbaseAddr.handleValuePair.value.lenを加算して、書き込まれた特性値の合計の長さを取得できます

サンプルコードは以下です。

次の変数を宣言します:

CYBLE_GATTS_EXEC_WRITE_REQ_T *longwrite;

CYBLE_GATT_HANDLE_VALUE_OFFSET_PARAM_T *dataaddress;

スタックイベントハンドラに、次のケース文を追加します:

case CYBLE_EVT_GATTS_EXEC_WRITE_REQ:

{

   uint8 length=0;

   uint8 writecount;

   //イベントパラメータを取得する

   longwrite= (CYBLE_GATTS_EXEC_WRITE_REQ_T *)eventParam;

   dataaddress= longwrite->baseAddr;

   //prepwritecount数を取得する

   writecount=longwrite->prepWriteReqCount;

   //prepwritecount個のbaseaddress.handevaluepair.value.lenを加算する

   for(int8 i=0;i<writecount;i++)

   length+= dataaddress.handleValuePair.value.len;

    printf("\nLength written is %d \n",length);

}

    break;

==========

BR,

Omoi

0 Likes
1 Reply
JennaJo
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello

We receive your translation, it will be published to KBA to Community.

I will get back to you after internal review, after that you will receive the point.

Due to the current volume of works, Please bear with me for the delayed the response,

Thanks for your contribution to CDC!

Will keep you update the status.

Thanks,

Jenna Jo

Jenna Jo