ThingWorx SCM Edge Extension for the ThingWorx Edge C SDK > SCM Edge Extension Capabilities > SCM State Transitions
  
SCM State Transitions
A deployment of an SCM package transitions through multiple states (twSwUpdateManager_TaskerFunction()). For a successful deployment, the states that it transitions through follow:
1. TW_SWUPDATE_CREATED
2. TW_SWUPDATE_NOTIFIED
3. TW_SWUPDATE_WAIT_FOR_DOWNLOAD
4. TW_SWUPDATE_START_DOWNLOAD
5. TW_SWUPDATE_DOWNLOADING. During this state, the download function returns TW_SWU_IN_PROGRESS, and the platform is notified that the package is being downloaded.
6. TW_SWUPDATE_DOWNLOADED. When the job transitions to this state, the download function returns TW_SWU_COMPLETE_SUCCESS. From this state, the job transfers to TW_SWUPDATE_WAIT_FOR_INSTALL_COMMAND. If the ScheduleInstall(time) service is called, the job transitions to TW_SWUPDATE_WAIT_FOR_INSTALL_DATETIME.
7. From the WAIT states, a successful job transitions to TW_SWUPDATE_INSTALLING at the scheduled time or when the install command is triggered.
* 
When a software job is recovered, restored jobs in the TW_SWUPDATE_INSTALLING state are transitioned directly to TW_SWUPDATE_COMPLETED. For details about recovering jobs after an SCM client reboot, see .
8. TW_SWUPDATE_COMPLETED
9. TW_SWUPDATE_DONE
Cancelled (Aborted) Deployments
If a user cancels the deployment (abort()), the deployment falls out of the general order listed above and transitions to the TW_SWUPDATE_ABORTED. The states in which this can happen follow:
TW_SWUPDATE_WAIT_FOR_DOWNLOAD
TW_SWUPDATE_START_DOWNLOAD
TW_SWUPDATE_DOWNLOADED
TW_SWUPDATE_WAIT_FOR_INSTALL_COMMAND
TW_SWUPDATE_WAIT_FOR_INSTALL_DATETIME
TW_SWUPDATE_INSTALLING
After transitioning to TW_SWAUPDATE_ABORTED, the job is ended. No additional state transitions occur.
Deployments Encountering Error
If a problem causes a deployment to stop (abort()), the deployment can transition as follows:
From TW_SWUPDATE_START_DOWNLOAD to TW_SWUPDATE_ABORTED
From TW_SWUPDATE_DOWNLOADING to TW_SWUPDATE_FAILED
From TW_SWUPDATE_INSTALLING to TW_SWUPDATE_ABORTED
When a job transitions to TW_SWUPDATE_ABORTED, it ends. No additional state transitions occur.
AIf an error occurs during installation, the job transitions to TW_SWUPDATE_FAILED. When the deployment transitions to TW_SWUPDATE_FAILED, it then transitions to the TW_SWUPDATE_DONE state.
Transitions After Invoking ScheduleInstall Service
When the ScheduleInstall() service is invoked, the job transitions to TW_SWUPDATE_WAIT_FOR_INSTALL_DATETIME from theTW_SWUPDATE_WAIT_FOR_INSTALL_COMMAND state.
How It Works
The following diagram illustrates the states that a Software Update Manager goes through to accomplish its goals. Each state transition is reported to listeners that have registered a handler.