Skip to content

Commit

Permalink
Remove private path in project file (#43)
Browse files Browse the repository at this point in the history
* Remove private path in project file
* Fix formatting
* Fix spelling
* Fix valid external link
  • Loading branch information
chinglee-iot authored Jun 5, 2024
1 parent 926e33e commit 2ae6e12
Show file tree
Hide file tree
Showing 19 changed files with 1,962 additions and 603 deletions.
1,317 changes: 1,317 additions & 0 deletions .github/.cSpellWords.txt

Large diffs are not rendered by default.

29 changes: 5 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,13 @@ jobs:
spell-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Parent Repo
uses: actions/checkout@v2
with:
ref: main
repository: FreeRTOS/CI-CD-Github-Actions
path: actions
- name: Clone This Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run spellings check
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ./NXPRef
- name: Install spell
run: |
sudo apt-get install spell
sudo apt-get install util-linux
- name: Check spelling
run: |
PATH=$PATH:actions/spellings/tools
# Make sure that the portable directory is not included in the spellcheck.
sed -i "s/-iname \\\\\*.\[ch\] -o/-not -path \\\*Middleware\\\\\/NXP\\\* -iname \\\\\*.\[ch\] -o/g" actions/spellings/tools/find-unknown-comment-words
find-unknown-comment-words --directory NXPRef/ --lexicon NXPRef/lexicon.txt
if [ "$?" = "0" ]; then
exit 0
else
exit 1
fi
path: ./

link-verifier:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion GSG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Many of these steps are automated in production environments.
[Configuration basics](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)
to configure the basic settings (security credentials, the default AWS output format and the default AWS Region)
that AWS CLI uses to interact with AWS.
* A serial terminal application, such as [Tera Term](https://ttssh2.osdn.jp/index.html.en).
* A serial terminal application, such as [Tera Term](https://teratermproject.github.io/index-en.html).


## 2 Hardware and Software Setup
Expand Down
32 changes: 32 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
# Allows things like stringLength
allowCompoundWords: true

# Read files not to spell check from the git ignore
useGitignore: true

# Language settings for C
languageSettings:
- caseSensitive: false
enabled: true
languageId: c
locale: "*"

# Add a dictionary, and the path to the word list
dictionaryDefinitions:
- name: freertos-words
path: '.github/.cSpellWords.txt'
addWords: true

dictionaries:
- freertos-words

# Paths and files to ignore
ignorePaths:
- 'dependency'
- 'docs'
- 'ThirdParty'
- 'History.txt'
- './Middleware/NXP/hostLib/mbedtls'
121 changes: 65 additions & 56 deletions examples/common/mqtt_agent/mqtt_agent_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,26 @@
* @brief Timeout for receiving CONNACK after sending an MQTT CONNECT packet.
* Defined in milliseconds.
*/
#define mqttexampleCONNACK_RECV_TIMEOUT_MS ( 2000U )
#define mqttexampleCONNACK_RECV_TIMEOUT_MS ( 2000U )

/**
* @brief The maximum number of retries for network operation with server.
* The configuration is set to retry forever. MQTT agent will retry in an infinite loop until
* its connected to broker.
*/
#define RETRY_MAX_ATTEMPTS ( BACKOFF_ALGORITHM_RETRY_FOREVER )
#define RETRY_MAX_ATTEMPTS ( BACKOFF_ALGORITHM_RETRY_FOREVER )

/**
* @brief The maximum back-off delay (in milliseconds) for retrying failed operation
* with server.
*/
#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U )
#define RETRY_MAX_BACKOFF_DELAY_MS ( 5000U )

/**
* @brief The base back-off delay (in milliseconds) to use for network operation retry
* attempts.
*/
#define RETRY_BACKOFF_BASE_MS ( 500U )
#define RETRY_BACKOFF_BASE_MS ( 500U )

/**
* @brief The maximum time interval in seconds which is allowed to elapse
Expand All @@ -144,13 +144,13 @@
* absence of sending any other Control Packets, the Client MUST send a
* PINGREQ Packet.
*//*_RB_ Move to be the responsibility of the agent. */
#define mqttexampleKEEP_ALIVE_INTERVAL_SECONDS ( 60U )
#define mqttexampleKEEP_ALIVE_INTERVAL_SECONDS ( 60U )

/**
* @brief Socket send and receive timeouts to use. Specified in milliseconds.
*/
#define mqttexampleTRANSPORT_SEND_TIMEOUT_MS ( 750 )
#define mqttexampleTRANSPORT_RECV_TIMEOUT_MS ( 0 )
#define mqttexampleTRANSPORT_SEND_TIMEOUT_MS ( 750 )
#define mqttexampleTRANSPORT_RECV_TIMEOUT_MS ( 0 )

/**
* @brief Configuration is used to turn on or off persistent sessions with MQTT broker.
Expand All @@ -159,19 +159,19 @@
* will be stored by the broker and resend to device, when it comes back online.
*
*/
#define mqttexamplePERSISTENT_SESSION_REQUIRED ( 0 )
#define mqttexamplePERSISTENT_SESSION_REQUIRED ( 0 )

/**
* @brief Used to convert times to/from ticks and milliseconds.
*/
#define mqttexampleMILLISECONDS_PER_SECOND ( 1000U )
#define mqttexampleMILLISECONDS_PER_TICK ( mqttexampleMILLISECONDS_PER_SECOND / configTICK_RATE_HZ )
#define mqttexampleMILLISECONDS_PER_SECOND ( 1000U )
#define mqttexampleMILLISECONDS_PER_TICK ( mqttexampleMILLISECONDS_PER_SECOND / configTICK_RATE_HZ )

/**
* @brief The MQTT agent manages the MQTT contexts. This set the handle to the
* context used by this demo.
*/
#define mqttexampleMQTT_CONTEXT_HANDLE ( ( MQTTContextHandle_t ) 0 )
#define mqttexampleMQTT_CONTEXT_HANDLE ( ( MQTTContextHandle_t ) 0 )

/**
* @brief Event Bit corresponding to an MQTT agent state.
Expand All @@ -188,7 +188,7 @@
#define mqttexampleEVENT_BITS_ALL ( ( EventBits_t ) ( ( 1ULL << MQTT_AGENT_NUM_STATES ) - 1U ) )


#define MQTT_AGENT_NOTIFY_IDX ( 3U )
#define MQTT_AGENT_NOTIFY_IDX ( 3U )
/*-----------------------------------------------------------*/

/**
Expand Down Expand Up @@ -738,21 +738,21 @@ static void prvIncomingPublishCallback( MQTTAgentContext_t * pMqttAgentContext,
* handle it as an unsolicited publish. */
if( xPublishHandled != true )
{
xPublishHandled = otaDemo_handleIncomingMQTTMessage( pxPublishInfo->pTopicName,
xPublishHandled = otaDemo_handleIncomingMQTTMessage( pxPublishInfo->pTopicName,
pxPublishInfo->topicNameLength,
pxPublishInfo->pPayload,
pxPublishInfo->payloadLength );

if( xPublishHandled != true )
{
if( xPublishHandled != true )
{
/* Ensure the topic string is terminated for printing. This will over-
* write the message ID, which is restored afterwards. */
pcLocation = ( char * ) &( pxPublishInfo->pTopicName[ pxPublishInfo->topicNameLength ] );
cOriginalChar = *pcLocation;
*pcLocation = 0x00;
LogWarn( ( "WARN: Received an unsolicited publish from topic %s", pxPublishInfo->pTopicName ) );
*pcLocation = cOriginalChar;
}
}
}
}

Expand Down Expand Up @@ -868,8 +868,8 @@ void prvMQTTAgentTask( void * pvParameters )
* which the error happened is returned so there is an attempt to
* clean up and reconnect. */

/* Set the MQTT context to be used by the MQTT wrapper. */
mqttWrapper_setCoreMqttContext( &( xGlobalMqttAgentContext.mqttContext ) );
/* Set the MQTT context to be used by the MQTT wrapper. */
mqttWrapper_setCoreMqttContext( &( xGlobalMqttAgentContext.mqttContext ) );

prvSetMQTTAgentState( MQTT_AGENT_STATE_CONNECTED );

Expand Down Expand Up @@ -1238,53 +1238,62 @@ MQTTStatus_t MqttAgent_SubscribeSync( const char * pcTopicFilter,
IncomingPubCallback_t pxCallback,
void * pvCallbackCtx )
{
BaseType_t xMQTTCallbackAdded;
MQTTStatus_t xResult;
BaseType_t xMQTTCallbackAdded;
MQTTStatus_t xResult;

xMQTTCallbackAdded = xAddMQTTTopicFilterCallback( pcTopicFilter,
xMQTTCallbackAdded = xAddMQTTTopicFilterCallback( pcTopicFilter,
uxTopicFilterLength,
pxCallback,
pvCallbackCtx,
pdFALSE );

if( xMQTTCallbackAdded == pdTRUE )
{
MQTTSubscribeInfo_t xSubInfo = { .qos = xRequestedQoS,
.pTopicFilter = pcTopicFilter,
.topicFilterLength = uxTopicFilterLength };
if( xMQTTCallbackAdded == pdTRUE )
{
MQTTSubscribeInfo_t xSubInfo =
{
.qos = xRequestedQoS,
.pTopicFilter = pcTopicFilter,
.topicFilterLength = uxTopicFilterLength
};

MQTTAgentSubscribeArgs_t xSubArgs = { .pSubscribeInfo = &xSubInfo,
.numSubscriptions = 1 };
MQTTAgentSubscribeArgs_t xSubArgs =
{
.pSubscribeInfo = &xSubInfo,
.numSubscriptions = 1
};

/* The block time can be 0 as the command loop is not running at this point. */
MQTTAgentCommandInfo_t xCommandParams = { .blockTimeMs = portMAX_DELAY,
.cmdCompleteCallback = prvSubscribeRqCallback,
.pCmdCompleteCallbackContext = ( void * ) ( xTaskGetCurrentTaskHandle() ) };
/* The block time can be 0 as the command loop is not running at this point. */
MQTTAgentCommandInfo_t xCommandParams =
{
.blockTimeMs = portMAX_DELAY,
.cmdCompleteCallback = prvSubscribeRqCallback,
.pCmdCompleteCallbackContext = ( void * ) ( xTaskGetCurrentTaskHandle() )
};

( void ) xTaskNotifyStateClearIndexed( NULL, MQTT_AGENT_NOTIFY_IDX );
( void ) xTaskNotifyStateClearIndexed( NULL, MQTT_AGENT_NOTIFY_IDX );

/* Enqueue subscribe to the command queue. These commands will be processed only
* when command loop starts. */
xResult = MQTTAgent_Subscribe( &xGlobalMqttAgentContext, &xSubArgs, &xCommandParams );

if( xResult == MQTTSuccess )
{
uint32_t ulNotifyValue = 0;

if( xTaskNotifyWaitIndexed( MQTT_AGENT_NOTIFY_IDX,
0x0,
0xFFFFFFFF,
&ulNotifyValue,
portMAX_DELAY ) )
{
xResult = ( ulNotifyValue & 0x00FFFFFF );
}
else
{
xResult = MQTTKeepAliveTimeout;
}
}
}

return 0;
* when command loop starts. */
xResult = MQTTAgent_Subscribe( &xGlobalMqttAgentContext, &xSubArgs, &xCommandParams );

if( xResult == MQTTSuccess )
{
uint32_t ulNotifyValue = 0;

if( xTaskNotifyWaitIndexed( MQTT_AGENT_NOTIFY_IDX,
0x0,
0xFFFFFFFF,
&ulNotifyValue,
portMAX_DELAY ) )
{
xResult = ( ulNotifyValue & 0x00FFFFFF );
}
else
{
xResult = MQTTKeepAliveTimeout;
}
}
}

return 0;
}
Loading

0 comments on commit 2ae6e12

Please sign in to comment.