Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cellular common AT command timeout config #101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
210a55c
Update cellular library to MIT license
chinglee-iot Mar 29, 2021
298ae4c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jun 30, 2021
21ea9bc
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 16, 2021
6690f3b
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 23, 2021
4a58d89
Merge branch 'FreeRTOS:main' into main
chinglee-iot Aug 24, 2021
955ebc0
Merge branch 'FreeRTOS:main' into main
chinglee-iot Oct 25, 2021
bba8adf
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 4, 2021
440bec9
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 9, 2021
a0fb7c7
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 16, 2021
b28ed63
Merge branch 'FreeRTOS:main' into main
chinglee-iot Nov 24, 2021
b40cb10
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 1, 2021
ca024c6
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 1, 2021
277d8b7
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 15, 2021
06402e9
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 21, 2021
a993410
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 21, 2021
45b9bcd
Merge branch 'FreeRTOS:main' into main
chinglee-iot Dec 27, 2021
cacbf87
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 6, 2022
128407c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 7, 2022
b1e3e46
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 10, 2022
70e76c4
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jan 11, 2022
107896c
Merge branch 'FreeRTOS:main' into main
chinglee-iot Feb 7, 2022
b3f4fab
Merge branch 'FreeRTOS:main' into main
chinglee-iot Mar 15, 2022
5027c96
Merge branch 'FreeRTOS:main' into main
chinglee-iot Apr 27, 2022
61f5c46
Merge branch 'FreeRTOS:main' into main
chinglee-iot May 11, 2022
14cb0e7
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jun 7, 2022
7a5972d
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jun 22, 2022
a566304
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 1, 2022
9dd71d0
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 7, 2022
4584fbb
Merge branch 'FreeRTOS:main' into main
chinglee-iot Jul 18, 2022
2ab65fc
Add cellular common AT command timeout config
chinglee-iot Aug 26, 2022
db12eac
Update Cellular_CommonATCommandRaw unit test
chinglee-iot Aug 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/cellular_common_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ CellularError_t Cellular_CommonATCommandRaw( CellularHandle_t cellularHandle,
atReqGetResult.dataLen = dataLen;
atReqGetResult.respCallback = responseReceivedCallback;

pktStatus = _Cellular_AtcmdRequestWithCallback( pContext, atReqGetResult );
pktStatus = _Cellular_TimeoutAtcmdRequestWithCallback( pContext,
atReqGetResult,
CELLULAR_AT_COMMAND_RAW_TIMEOUT_MS );
cellularStatus = _Cellular_TranslatePktStatus( pktStatus );
}

Expand Down
26 changes: 26 additions & 0 deletions source/include/cellular_config_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,32 @@
#define CELLULAR_CONFIG_STATIC_SOCKET_CONTEXT_ALLOCATION ( 0 )
#endif

/**
* @brief Cellular common AT command timeout.<br>
*
* The timeout value for Cellular_Common prefix APIs. The timeout value should be
* set according to spec. It should be long enough for AT command used in cellular
* common APIs.
*
* <b>Possible values:</b>`Any positive integer`<br>
* <b>Default value (if undefined):</b> 5000
*/
#ifndef CELLULAR_COMMON_AT_COMMAND_TIMEOUT_MS
#define CELLULAR_COMMON_AT_COMMAND_TIMEOUT_MS ( 5000U )
#endif

/**
* @brief Cellular AT command raw timeout.<br>
*
* The timeout value for Cellular_ATCommandRaw API.
*
* <b>Possible values:</b>`Any positive integer`<br>
* <b>Default value (if undefined):</b> 5000
*/
#ifndef CELLULAR_AT_COMMAND_RAW_TIMEOUT_MS
#define CELLULAR_AT_COMMAND_RAW_TIMEOUT_MS ( 5000U )
#endif

/**
* @brief Macro that is called in the cellular library for logging "Error" level
* messages.
Expand Down
2 changes: 1 addition & 1 deletion source/include/private/cellular_pkthandler_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/*-----------------------------------------------------------*/

/* AT Command timeout for general AT commands. */
#define PACKET_REQ_TIMEOUT_MS ( 5000UL )
#define PACKET_REQ_TIMEOUT_MS CELLULAR_COMMON_AT_COMMAND_TIMEOUT_MS

/*-----------------------------------------------------------*/

Expand Down
4 changes: 2 additions & 2 deletions test/unit-test/cellular_common_api_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void test_Cellular_CommonATCommandRaw_AtCmd_Bad_Request( void )
char pData[] = "Test Data";

_Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS );
_Cellular_AtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_BAD_REQUEST );
_Cellular_TimeoutAtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_BAD_REQUEST );
_Cellular_TranslatePktStatus_IgnoreAndReturn( CELLULAR_INTERNAL_FAILURE );

cellularStatus = Cellular_CommonATCommandRaw( &context, pPrefix, pData, 0, NULL, NULL, 0 );
Expand All @@ -557,7 +557,7 @@ void test_Cellular_CommonATCommandRaw_Happy_Path( void )
char pData[] = "Test Data";

_Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS );
_Cellular_AtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK );
_Cellular_TimeoutAtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK );
_Cellular_TranslatePktStatus_IgnoreAndReturn( CELLULAR_SUCCESS );

cellularStatus = Cellular_CommonATCommandRaw( &context, pPrefix, pData, 0, NULL, NULL, 0 );
Expand Down