This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add read long value test #1477
Merged
Merged
Add read long value test #1477
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,9 @@ TEST_GROUP_RUNNER( Full_BLE ) | |
#if ENABLE_TC_AFQP_WRITE_LONG | ||
RUN_TEST_CASE( Full_BLE, BLE_Property_WriteLongCharacteristic ); | ||
#endif | ||
#if ENABLE_TC_AFQP_READ_LONG | ||
RUN_TEST_CASE( Full_BLE, BLE_Property_ReadLongCharacteristic ); | ||
#endif | ||
|
||
RUN_TEST_CASE( Full_BLE, BLE_Property_WriteCharacteristic ); | ||
RUN_TEST_CASE( Full_BLE, BLE_Property_WriteDescriptor ); | ||
|
@@ -651,6 +654,44 @@ TEST( Full_BLE, BLE_Property_WriteLongCharacteristic ) | |
} | ||
} | ||
|
||
TEST( Full_BLE, BLE_Property_ReadLongCharacteristic ) | ||
{ | ||
BLETESTreadAttrCallback_t xReadEvent; | ||
BTGattResponse_t xGattResponse; | ||
BLETESTconfirmCallback_t xConfirmEvent; | ||
BTStatus_t xStatus; | ||
uint8_t LongReadBuffer[ bletests_LONG_WRITE_LEN ]; | ||
|
||
memset( LongReadBuffer, 49, bletests_LONG_WRITE_LEN * sizeof( uint8_t ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of memset you can directly assign to {0} in the declaration above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now we just use the same value { '1', '1', '1', ...} that the long write test sent. It's easier to check the value on the RPi side. |
||
|
||
/* Read transaction */ | ||
xReadEvent = IotTestBleHal_ReadReceive( bletestATTR_SRVCB_CHAR_A ); | ||
|
||
xGattResponse.usHandle = xReadEvent.usAttrHandle; | ||
xGattResponse.xAttrValue.usHandle = xReadEvent.usAttrHandle; | ||
xGattResponse.xAttrValue.usOffset = xReadEvent.usOffset; | ||
xGattResponse.xAttrValue.xLen = bletests_LONG_WRITE_LEN; | ||
xGattResponse.xAttrValue.pucValue = LongReadBuffer; | ||
_pxGattServerInterface->pxSendResponse( xReadEvent.usConnId, xReadEvent.ulTransId, eBTStatusSuccess, &xGattResponse ); | ||
|
||
xStatus = IotTestBleHal_WaitEventFromQueue( eBLEHALEventConfimCb, usHandlesBufferB[ bletestATTR_SRVCB_CHAR_A ], ( void * ) &xConfirmEvent, sizeof( BLETESTconfirmCallback_t ), BLE_TESTS_WAIT ); | ||
TEST_ASSERT_EQUAL( eBTStatusSuccess, xConfirmEvent.xStatus ); | ||
TEST_ASSERT_EQUAL( usHandlesBufferB[ bletestATTR_SRVCB_CHAR_A ], xConfirmEvent.usAttrHandle ); | ||
|
||
/* Read blob transaction */ | ||
xStatus = IotTestBleHal_WaitEventFromQueue( eBLEHALEventReadAttrCb, usHandlesBufferB[ bletestATTR_SRVCB_CHAR_A ], ( void * ) &xReadEvent, sizeof( BLETESTreadAttrCallback_t ), BLE_TESTS_WAIT ); | ||
xGattResponse.usHandle = xReadEvent.usAttrHandle; | ||
xGattResponse.xAttrValue.usHandle = xReadEvent.usAttrHandle; | ||
xGattResponse.xAttrValue.usOffset = xReadEvent.usOffset; | ||
xGattResponse.xAttrValue.xLen = bletests_LONG_WRITE_LEN - xReadEvent.usOffset; | ||
xGattResponse.xAttrValue.pucValue = LongReadBuffer + xReadEvent.usOffset; | ||
_pxGattServerInterface->pxSendResponse( xReadEvent.usConnId, xReadEvent.ulTransId, eBTStatusSuccess, &xGattResponse ); | ||
|
||
xStatus = IotTestBleHal_WaitEventFromQueue( eBLEHALEventConfimCb, usHandlesBufferB[ bletestATTR_SRVCB_CHAR_A ], ( void * ) &xConfirmEvent, sizeof( BLETESTconfirmCallback_t ), BLE_TESTS_WAIT ); | ||
TEST_ASSERT_EQUAL( eBTStatusSuccess, xConfirmEvent.xStatus ); | ||
TEST_ASSERT_EQUAL( usHandlesBufferB[ bletestATTR_SRVCB_CHAR_A ], xConfirmEvent.usAttrHandle ); | ||
} | ||
|
||
TEST( Full_BLE, BLE_Connection_ChangeMTUsize ) | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bletests_LONG_WRITE_LEN - Can we have a separate define for the long reads, like bletests_LONG_READ_LEN
Also its better to not allocate long read buffer on stack, as it might over flow the stack buffer. Could be a static global variable instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure