You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {String} currentMainField1 - The main field value text shown on the head unit
61
+
*/
62
+
setCurrentMainField1(currentMainField1){
63
+
this._currentMainField1=currentMainField1;
64
+
}
65
+
66
+
/**
67
+
* The method that causes the task to run.
68
+
* @param {_Task} task - The task instance
69
+
* @returns {Promise} - This promise does not resolve to any value
70
+
*/
71
+
asynconExecute(task){
72
+
if(this.getState()===_Task.CANCELED){
73
+
this.onFinished();
74
+
return;
75
+
}
76
+
77
+
// Check the state of our images
78
+
if(!this._supportsSoftButtonImages()){
79
+
// We don't support images at all
80
+
console.warn('SoftButtonTransitionOperation - Soft button images are not supported. Attempting to send text-only soft buttons. If any button does not contain text, no buttons will be sent.');
81
+
// Send text buttons if all the soft buttons have text
console.error('SoftButtonTransitionOperation - Head unit does not support images and some of the soft buttons do not have text, so none of the buttons will be sent.');
// Send text buttons if all the soft buttons have text
89
+
awaitthis._sendCurrentStateTextOnlySoftButtons();
90
+
91
+
// Upload initial images
92
+
awaitthis._uploadInitialStateImages();
93
+
94
+
// Send initial soft buttons w/ images
95
+
awaitthis._sendCurrentStateSoftButtons();
96
+
97
+
// Upload other images
98
+
awaitthis._uploadOtherStateImages();
99
+
}else{
100
+
// All the images are already uploaded. Send initial soft buttons w/ images.
101
+
awaitthis._sendCurrentStateSoftButtons();
102
+
103
+
awaitthis._uploadOtherStateImages();
104
+
}
105
+
106
+
this.onFinished();
107
+
}
108
+
109
+
/**
110
+
* Returns text soft buttons representing the current states of the button objects, or returns if any of the buttons' current states are image only buttons.
111
+
* @private
112
+
* @returns {Promise} - Resolves to whether the operation is successful
113
+
*/
114
+
async_sendCurrentStateTextOnlySoftButtons(){
115
+
if(this.getState()===_Task.CANCELED){
116
+
returnfalse;
117
+
}
118
+
119
+
console.log('SoftButtonTransitionOperation - Preparing to send text-only soft buttons');
console.warn('SoftButtonTransitionOperation - Attempted to create text buttons, but some buttons don\'t support text, so no text-only soft buttons will be sent');
126
+
returnfalse;
127
+
}
128
+
// We should create a new softButtonObject rather than modifying the original one
129
+
consttextOnlySoftButton=newSoftButton()
130
+
.setType(SoftButtonType.SBT_TEXT)
131
+
.setText(softButton.getText())
132
+
.setIsHighlighted(softButton.getIsHighlighted())
133
+
.setSoftButtonID(softButton.getSoftButtonID())
134
+
.setSystemAction(softButton.getSystemAction());
135
+
136
+
textButtons.push(textOnlySoftButton);
137
+
}
138
+
139
+
if(this._lifecycleManager===null){
140
+
console.error('SoftButtonTransitionOperation: LifecycleManager is null');
0 commit comments