52 #define SMS_KEY_CYCLE_DELAY 1500 59 enum {choosing, chosen} state;
60 E_MHEG5_KEY current_key;
62 U32BIT last_press_time;
63 char previous_character;
71 {4, (MHEG5Byte *)
"&@_0"},
72 {11, (MHEG5Byte *)
" .,-?!':;/1"},
73 {7, (MHEG5Byte *)
"abcABC2"},
74 {7, (MHEG5Byte *)
"defDEF3"},
75 {7, (MHEG5Byte *)
"ghiGHI4"},
76 {7, (MHEG5Byte *)
"jklJKL5"},
77 {7, (MHEG5Byte *)
"mnoMNO6"},
78 {9, (MHEG5Byte *)
"pqrsPQRS7"},
79 {7, (MHEG5Byte *)
"tuvTUV8"},
80 {9, (MHEG5Byte *)
"wxyzWXYZ9"}
86 static const MHEG5String char_list_any = {76, (MHEG5Byte *)
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&@_0 .,-?!':;/0123456789"};
88 static const MHEG5String char_list_alpha = {52, (MHEG5Byte *)
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};
90 static const MHEG5String char_list_numeric = {10, (MHEG5Byte *)
"0123456789"};
94 static H_Timer SMSTimer;
99 static char SMS_GetNextEnabledChar(
MHEG5Entryfield *entryfield,
int key);
100 static int SMS_CharsListedForKey(
MHEG5Entryfield *entryfield,
int key );
101 static void SMS_TimerCallback(BOOLEAN triggered,
void *callerRef, H_Timer timerHandle);
112 MHEG5textPrint(&entryfield->text, out);
113 MHEG5interactiblePrint(&entryfield->interactible, out);
116 MHEG_PRINT(out,
":InputType ");
117 switch (entryfield->inputType)
120 MHEG_PRINT(out,
"Alpha");
123 MHEG_PRINT(out,
"Numeric");
126 MHEG_PRINT(out,
"Any");
129 MHEG_PRINT(out,
"Listed");
132 MHEG_PRINT(out,
"Internal Error");
137 MHEG_PRINT(out,
":Charlist ");
138 MHEG5stringPrint(entryfield->charList, out);
141 MHEG_PRINT(out,
":ObscuredInput ");
142 MHEG5boolPrint(entryfield->obscuredInput, out);
145 MHEG_PRINT(out,
":Maxlength ");
146 MHEG5intPrint(entryfield->maxlength, out);
149 MHEG_PRINT(out,
":OverwriteMode ");
150 MHEG5boolPrint(entryfield->overwriteMode, out);
153 MHEG_PRINT(out,
"// EntryPoint:\t");
154 MHEG5intPrint(entryfield->entryPoint, out);
171 save = entryfield->text.visible.ingredient.data;
174 entryfield->text.visible.ingredient.data =
175 MHEG5getMem((entryfield->text.visible.ingredient.dataLen + 1) *
sizeof(
unsigned short));
177 if (entryfield->text.visible.ingredient.data)
182 memcpy(entryfield->text.visible.ingredient.data,
183 save, entryfield->text.visible.ingredient.dataLen *
sizeof(
unsigned short));
186 entryfield->text.visible.ingredient.dataLen++;
188 if (entryfield->text.visible.ingredient.dataLen > 1)
200 entryfield->text.visible.ingredient.data = save;
214 unsigned short *data;
216 if ((entryfield->maxlength > 0) && (entryfield->entryPoint >= entryfield->maxlength))
221 if (entryfield->entryPoint < 0)
223 entryfield->entryPoint = 0;
226 if (entryfield->entryPoint >= entryfield->text.visible.ingredient.dataLen)
228 entryfield->entryPoint = entryfield->text.visible.ingredient.dataLen;
230 else if (entryfield->overwriteMode)
232 data = (
unsigned short *)entryfield->text.visible.ingredient.data;
233 data[entryfield->entryPoint] = c;
234 entryfield->entryPoint++;
238 if ((entryfield->maxlength > 0) && (entryfield->text.visible.ingredient.dataLen >= entryfield->maxlength))
245 MHEG5entryfieldAppend(entryfield);
248 data = (
unsigned short *)entryfield->text.visible.ingredient.data;
251 for (i = entryfield->text.visible.ingredient.dataLen - 1; i > entryfield->entryPoint; i--)
253 data[i] = data[i - 1];
257 data[entryfield->entryPoint] = c;
258 entryfield->entryPoint++;
285 if (SMSTimer != NULL)
287 mhegTimerDestroy(SMSTimer);
293 switch (entryfield->inputType)
326 entryfield->entryPoint = 0;
327 entryfield->overwriteMode = MHEG5FALSE;
332 switch (entryfield->inputType)
336 entryfield->charList = char_list_alpha;
340 entryfield->charList = char_list_any;
346 entryfield->charList = char_list_numeric;
356 entryfield->charList = char_list_numeric;
372 if (!entryfield->text.visible.ingredient.root.availabilityStatus)
375 entryfield->entryPoint = 0;
376 entryfield->overwriteMode = MHEG5FALSE;
410 MHEG5interactibleDestruct(&entryfield->interactible);
432 if (target->clazz != MHEG5ENTRYFIELD)
434 return MHEG5ERR_WRONGTARGET;
438 return MHEG5ERR_WRONGNUMBEROFPARAMS;
441 MHEG5resolveGenericBoolean(params, &newMode);
443 item->overwriteMode = newMode;
447 return MHEG5ERR_NOERROR;
467 if (target->clazz != MHEG5ENTRYFIELD)
469 return MHEG5ERR_WRONGTARGET;
473 return MHEG5ERR_WRONGNUMBEROFPARAMS;
476 MHEG5resolveORef(params, &boolVar);
479 return MHEG5ERR_WRONGPARAM;
481 if (boolVar->clazz != MHEG5BOOLEANVARIABLE)
483 return MHEG5ERR_WRONGPARAM;
485 if (!boolVar->runningStatus)
487 return MHEG5ERR_PARAMNOTACTIVE;
490 rc->value = item->overwriteMode;
492 return MHEG5ERR_NOERROR;
511 if (target->clazz != MHEG5ENTRYFIELD)
513 return MHEG5ERR_WRONGTARGET;
517 return MHEG5ERR_WRONGNUMBEROFPARAMS;
520 MHEG5resolveGenericInteger(params, &newPoint);
522 if (newPoint > item->text.visible.ingredient.dataLen)
524 newPoint = item->text.visible.ingredient.dataLen;
530 if (item->entryPoint != newPoint)
532 item->entryPoint = newPoint;
538 return MHEG5ERR_NOERROR;
558 if (target->clazz != MHEG5ENTRYFIELD)
560 return MHEG5ERR_WRONGTARGET;
564 return MHEG5ERR_WRONGNUMBEROFPARAMS;
567 MHEG5resolveORef(params, &intVar);
570 return MHEG5ERR_WRONGPARAM;
572 if (intVar->clazz != MHEG5INTEGERVARIABLE)
574 return MHEG5ERR_WRONGPARAM;
576 if (!intVar->runningStatus)
578 return MHEG5ERR_PARAMNOTACTIVE;
581 rc->value = item->entryPoint;
583 return MHEG5ERR_NOERROR;
593 if (entryfield->entryPoint > entryfield->text.visible.ingredient.dataLen)
595 entryfield->entryPoint = entryfield->text.visible.ingredient.dataLen;
598 if (entryfield->entryPoint > 0)
601 unsigned short *data;
603 data = (
unsigned short *)entryfield->text.visible.ingredient.data;
605 for (i = entryfield->entryPoint; i < entryfield->text.visible.ingredient.dataLen; i++)
607 data[i - 1] = data[i];
609 entryfield->entryPoint--;
610 entryfield->text.visible.ingredient.dataLen--;
612 if (entryfield->text.visible.ingredient.dataLen == 0)
615 MHEG5freeMem(entryfield->text.visible.ingredient.data);
616 entryfield->text.visible.ingredient.data = 0;
628 if (entryfield->entryPoint > 0)
630 entryfield->entryPoint--;
641 if (entryfield->entryPoint < entryfield->text.visible.ingredient.dataLen)
643 entryfield->entryPoint++;
658 entryfield->interactible.interactionStatus = MHEG5FALSE;
659 scene->currentInteractible = 0;
661 MHEG5interactibleInteractionCompleted(&entryfield->interactible, (
MHEG5Root *)entryfield);
671 if (entryfield->text.visible.ingredient.dataLen)
673 entryfield->text.visible.ingredient.dataLen = 0;
674 MHEG5freeMem(entryfield->text.visible.ingredient.data);
676 entryfield->text.visible.ingredient.data = 0;
677 entryfield->entryPoint = 0;
688 E_MHEG5_KEY ui,
int key_number)
692 MHEG5Int current_position;
694 assert( ui >= MHEG5_KEY_0 && ui <= MHEG5_KEY_9 );
697 if (entry_state.entryfield != entryfield)
699 entry_state.entryfield = entryfield;
700 entry_state.state = chosen;
701 entry_state.current_key = (E_MHEG5_KEY)-1;
703 current_position = entryfield->text.visible.ingredient.dataLen;
705 if (SMSTimer != NULL)
707 mhegTimerDestroy(SMSTimer);
713 if (entry_state.current_key == ui &&
714 entry_state.state == choosing &&
715 entry_state.last_press_time + SMS_KEY_CYCLE_DELAY > current_time)
718 next_char = SMS_GetNextEnabledChar(entryfield, key_number);
721 if (!entryfield->overwriteMode)
730 entry_state.previous_character = next_char;
734 char backup_char = entry_state.previous_character;
736 entry_state.current_key = ui;
737 entry_state.key_map_index = -1;
740 if (entryfield->overwriteMode ||
741 entryfield->maxlength == 0 ||
742 entryfield->maxlength > entryfield->text.visible.ingredient.dataLen)
744 entry_state.state = choosing;
746 next_char = SMS_GetNextEnabledChar(entryfield, key_number);
751 entry_state.previous_character = next_char;
753 char_count = SMS_CharsListedForKey(entryfield, key_number);
756 entry_state.state = chosen;
757 if (current_position < entryfield->maxlength &&
758 entryfield->maxlength > 0 &&
759 entryfield->text.visible.ingredient.dataLen >= entryfield->maxlength)
771 next_char = backup_char;
772 entry_state.state = chosen;
777 entry_state.previous_character = backup_char;
778 if (current_position < entryfield->maxlength &&
779 entryfield->maxlength > 0 &&
780 entryfield->text.visible.ingredient.dataLen >= entryfield->maxlength)
791 entry_state.last_press_time = current_time;
793 if (entry_state.state == choosing)
796 mhegTimerCreate(SMS_KEY_CYCLE_DELAY, (F_TimerCallback)SMS_TimerCallback, (
void *)entryfield, &SMSTimer);
821 MHEG5entryfieldSMSEntry(entryfield, ui, (
int)ui - (
int)MHEG5_KEY_0);
825 entry_state.state = chosen;
829 entry_state.state = chosen;
833 case MHEG5_KEY_RIGHT:
834 entry_state.state = chosen;
837 case MHEG5_KEY_CANCEL:
840 case MHEG5_KEY_SELECT:
841 entry_state.state = chosen;
846 entry_state.state = chosen;
851 if (entry_state.state == chosen)
853 MHEG5drawEntry( entryfield, CURSOR_INSERT);
857 MHEG5drawEntry( entryfield, CURSOR_REPLACE);
870 static char SMS_GetNextEnabledChar(
MHEG5Entryfield *entryfield,
int key)
879 map_string = &(SMS_map[key]);
880 permitted_list = &(entryfield->charList);
883 idx = entry_state.key_map_index;
886 for (i = 0; i < map_string->len; i++)
890 if (idx >= map_string->len)
897 for (j = 0; j < permitted_list->len; j++)
899 if (permitted_list->data[j] == map_string->data[idx])
908 next_char = map_string->data[idx];
909 entry_state.key_map_index = idx;
923 static int SMS_CharsListedForKey(
MHEG5Entryfield *entryfield,
int key )
930 map_string = &(SMS_map[key]);
931 permitted_list = &(entryfield->charList);
935 for (i = 0; i < map_string->len; i++)
938 for (j = 0; j < permitted_list->len; j++)
940 if (permitted_list->data[j] == map_string->data[i])
950 void entryfieldSMSTimeout(
void *data )
957 if (param->triggered)
961 if (entry_state.last_press_time + SMS_KEY_CYCLE_DELAY <= current_time)
963 entry_state.state = chosen;
964 mhegTimerDestroy(SMSTimer);
967 MHEG5drawEntry( field_ref, CURSOR_INSERT);
970 if ((field_ref->maxlength > 0) && (field_ref->text.visible.ingredient.dataLen >= field_ref->maxlength))
981 time = (entry_state.last_press_time + SMS_KEY_CYCLE_DELAY) - current_time;
982 mhegTimerCreate(time, (F_TimerCallback) SMS_TimerCallback, (
void *)field_ref, &SMSTimer);
987 static void SMS_TimerCallback(BOOLEAN triggered,
void *callerRef,
994 event.proc_msg_func = entryfieldSMSTimeout;
995 event.data_type = DT_VALUE;
996 event.data.timer.triggered = triggered;
997 event.data.timer.callerRef = callerRef;
998 event.data.timer.timerHandle = (
void *)timerHandle;
1000 if (err != MHERR_OK)
1002 TRACE(TERROR, (
"VQ_PutMsg returned Error %d", err))
void MHEG5entryfieldDestruct(MHEG5Entryfield *entryfield)
Destruct a entryfield object.
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
void MHEG5entryfieldSELECT(MHEG5Entryfield *entryfield)
Perform action of select key on interacting Entryfield.
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post event or section message on queue. Copies data into queue.
void MHEG5entryfieldEXIT(MHEG5Entryfield *entryfield)
Perform action of exit key on interacting Entryfield.
void MHEG5entryfieldActivate(MHEG5Entryfield *entryfield)
Apply the activation behaviour of the entryfield class. As this class has no own activation behaviour...
void MHEG5textDestruct(MHEG5Text *text)
Destruct a text object.
void MHEG5entryfieldDeactivate(MHEG5Entryfield *entryfield)
Apply the deactivation behaviour of the entryfield class. As this class has no own deactivation behav...
void MHEG5textPrepare(MHEG5Text *text)
Apply the preparation behaviour of the text class Apply the preparation behaviour of the text class...
Implement the MHEG5 Variable Class 21 Variable Class Defines a variable within the context of a Group...
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
void MHEG5entryfieldPrepare(MHEG5Entryfield *entryfield)
Apply the preparation behaviour of the entryfield class Apply the preparation behaviour of the entryf...
MHEG5ErrorCode MHEG5getOverwriteMode(MHEG5Root *target, MHEG5GList *params)
Retrieve the overwrite mode of the entryfield Implementation of the GetOverwriteMode action of the en...
void MHEG5entryfieldRIGHT(MHEG5Entryfield *entryfield)
Perform action of right arrow key on interacting Entryfield.
void MHEG5interactibleDeactivate(MHEG5Interactible *interactible)
Implementation of the deactivation behaviour of the interactible class. This behaviour was introduced...
MHEG5ErrorCode MHEG5setOverwriteMode(MHEG5Root *target, MHEG5GList *params)
Set the overwrite mode of the entryfield to the new value of the parameter Implementation of the SetO...
void MHEG5entryfieldUserInput(MHEG5Entryfield *entryfield, E_MHEG5_KEY ui)
Test user input and perform required actions.
void MHEG5entryfieldInsert(MHEG5Entryfield *entryfield, unsigned short c)
Add the character |c| to the Entryfield.
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
void MHEG5textDeactivate(MHEG5Text *text)
Apply the deactivation behaviour of the text class. As this class has no own deactivation behaviour t...
MHEG5ErrorCode MHEG5getEntryPoint(MHEG5Root *target, MHEG5GList *params)
Retrieve the current entrypoint of the entryfield Implementation of the GetEntryPoint action of the e...
void MHEG5textInit(MHEG5Text *text)
<Function description>="">
Implement functions to retrieve MHEG5objects by GroupID and ID.
Implementation of the MHEG5 Application Class Defines a set of Ingredient objects, which are shared within an application scope. Base class: Group Subclasses: None Status: Concrete class.
Implementation of the MHEG5 Scene Class Scene Class Defines a set of Ingredient objects to be activat...
void MHEG5textActivate(MHEG5Text *text)
Apply the activation behaviour of the text class. As this class has no own activation behaviour this ...
MHEG class interface to graphics text render.
void MHEG5interactibleInit(MHEG5Interactible *interactible)
<Function description>="">
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
void MHEG5sendEvent(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the asynchronous event queue.
MHEG5ErrorCode MHEG5setEntryPoint(MHEG5Root *target, MHEG5GList *params)
Set the entrypoint for the entryfield Implementation of the SetEntryPoint action of the entryfield cl...
The timer module allows the use of timers within the MHEG5 component. These timers can be set by othe...
MHEG5Bool MH5_SupportInteractionChannel(void)
Return whether Interaction channel is supported by current profile.
void MHEG5interactibleFree(MHEG5Interactible *interactible)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5entryfieldLEFT(MHEG5Entryfield *entryfield)
Perform action of left arrow key on interacting Entryfield.
void MHEG5entryfieldFree(MHEG5Entryfield *entryfield)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5entryfieldInit(MHEG5Entryfield *entryfield)
Initialise an entryfield object with default values.
void MHEG5textFree(MHEG5Text *text)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void MHEG5interactiblePrepare(MHEG5Interactible *interactible)
Sets all internal attributes for the specified object to their default values.
void MHEG5entryfieldBACKSPACE(MHEG5Entryfield *entryfield)
Perform action of backspace key on interacting Entryfield.
Key Press related functionality.
Engine support utility functions for MHEG5.
Implement the MHEG5 EntryField Class. Defines an interaction widget used by the final user to edit an...
Header file - Function prototypes for operating system.