The userBlockEvent() function is called at block events, such as block repaint, end of time step, and simulation end.
LPSTR PASCAL userBlockEvent(HWND h, int msg, WPARAM wp,LPARAM lp)
This function lets you save and restore mixed data types. Note that the arguments are the same as Windows or Windows NT event functions.
Embed calls your function with the following messages:
Message |
Description |
VBF_FRAME_END |
Reserved. |
WM_VSM_ADD_CONNECTOR |
Signals a user-request for
a connector to be added to a block. |
WM_VSM_ALLOC_VEC_OUTPUT |
This event is generated
after inputs are allocated. This event allows user DLL to allocate vector
outputs. |
WM_VSM_BLOCK_INFO |
Used for writing a custom optimizer. |
WM_VSM_BLOCK_LABEL |
Provides a block label.
Return a null terminated string for label under
block. |
WM_VSM_BLOCK_PLACED |
Signals that a block has
been placed in the diagram. |
WM_VSM_BLOCK_SETUP |
This event is generated
only if there is no userBlockPC() function defined for the block.
This event is generated when you right-click the block.
|
WM_VSM_CAN_ACCEPT_ALTERNATE_TYPE |
Checks if block inputs can
accept alternate data type. Returns 0 if NO, 1 if
YES. |
WM_VSM_CHECKPOINT_STATE |
Signals a user-request to checkpoint system states; that is, set the checkpoint buffer to the current state value. |
WM_VSM_CONNECTOR_NAME |
Returns string of
connector label name. Null if no label is
desired. |
WM_VSM_CREATE |
Is called when a user
block is created. You can return flags to customize block treatment. (For
more information, see “Return flags for WM_VSM_CREATE,”
below.) |
WM_VSM_DEL_CONNECTOR |
Signals a user-request for
a connector to be deleted from a block. |
WM_VSM_DESTROY |
Is called when user block
is destroyed. |
WM_VSM_FILE_CLOSE |
Reserved. |
WM_VSM_FILE_READ |
Signals that block and all
its parameters have been read in from
file. |
WM_VSM_GET_BANNER_STR |
Reserved. |
WM_VSM_GET_BLOCK_BITMAP |
Reserved. |
WM_VSM_GET_BLOCK_NAME |
Provides a block with a custom name. Return a null terminated string that contains the new name. The name may contain newline characters. |
WM_VSM_GET_CODEGEN_ALLOC_STRING: |
Returns C code for file
scope declarations used in WM_VSM_GET_CODEGEN_STRING and WM_VSM_GET_CODEGEN_START_STRING. |
WM_VSM_GET_CODEGEN_BACKGROUND_TASK |
Returns text of background
function. |
WM_VSM_GET_CODEGEN_END_STRING |
Returns C code string to
execute after simulation terminates. |
WM_VSM_GET_CODEGEN_INCLUDE_STRING |
Sent during code generation. If used, returns text of include file line; otherwise, null. |
WM_VSM_GET_CODEGEN_PORT_STORAGE |
Returns C code to supply
result value on output connector wp. |
WM_VSM_GET_CODEGEN_POST_END_STRING |
Sent after all WM_VSM_GET_CODEGEN_END_STRING |
WM_VSM_GET_CODEGEN_POST_START_STRING
|
Sent after all WM_VSM_GET_CODEGEN_START_STRING. |
WM_VSM_GET_CODEGEN_START_STRING: |
Returns C code for block
initialization. |
WM_VSM_GET_CODEGEN_STRING |
Returns C code string for
main time step function. %1 expands to code for input connector 1; %2
expands to code for input connector 2, and so
on. |
WM_VSM_GET_CODEGEN_TARGET |
Reserved. |
WM_VSM_GET_CODEGEN_TIME_STEP_STRING |
Reserved. |
WM_VSM_GET_CONNECTOR_TYPE |
Puts a data type on a
connector. If you do not handle the message, the connector type is
T_DOUBLE. The connector types that can be returned are: T_DOUBLE, T_FLOAT,
T_INT, T_LONG, T_ULONG,T_CHAR, T_UCHAR, T_SHORT, T_USHORT, T_STRING,
T_MAT_DOUBLE, T_MAT_COMPLEX, T_POINTER, T_COMBO_ITEM, T_SCALED_INT,
T_COMPLEX, and T_LAST. |
WM_VSM_GET_CONNECTOR_TYPE_STR |
Supplies the text string
of the pointer. The string returned should provide good indication of the
data structure pointed to. For example, “cv::Mat*” is a pointer to an
OpenVision image. |
WM_VSM_GET_DEFAULT_IN_VAL |
Reserved. |
WM_VSM_GET_IGNORE_MENU_GRAYING |
Returns TRUE if block
should not be grayed in the Viewer. |
WM_VSM_GET_OBJ_CLASS |
Reserved. |
WM_VSM_GET_OUT_SIG_VEC |
Reserved. |
WM_VSM_GET_PARAM |
Reserved. |
WM_VSM_GET_PARAM_DESC |
Provides a data descriptor
for saving and restoring data. Return a text string that describes your
data by following these formatting guidelines: “F [2] c[32]” In Fortran, the string notation is: ‘F [2] c[32]’
c |
WM_VSM_GET_PARAM_STR |
Returns pointer to
parameter strings with a semi-colon separator.
wp:
0 |
WM_VSM_GET_SEARCH_STR |
If the block has
searchable string, it returns
it. |
WM_VSM_INFO |
Reserved. |
WM_VSM_IS_VEC_CONNECT |
This event is generated
when user attempts to connect a block. User returns a value. If the value
is 1, the vector or matrix input or output is allowed. If the value is 0,
scalar input or output is allowed. |
WM_VSM_PIN_CONNECTED |
Informs the block event
handler that a connection has been made of the given data type.
|
WM_VSM_POST_SIM_START |
This event is generated
after all simulation start messages. |
WM_VSM_PRE_SIM_START |
This event is generated
after simulation-wide VSE_PRE_SIM_START and before any other block
receives WM_VSM_SIM_START. |
WM_VSM_PUT_PARAM |
Reserved. |
WM_VSM_REPORT_FILENAME |
This message is sent when
working with a VSMX file. It allows transferring data both ways. If wParam
is NULL, Embed expects the file name or NULL if none. If wParam is not
NULL, Embed provides the path to use inside the
add-on. |
WM_VSM_RETAIN_STATE_RESTART |
Restarts with retained
states. |
WM_VSM_SET_SEARCH_STR |
Sets a new block
string. |
WM_VSM_SIM_END |
Reserved. |
WM_VSM_SIM_RESET |
This message is sent on
simulation reset when the user presses the RESET
button. |
WM_VSM_SIM_RESTART |
Signals restart due to
continue or single step. |
WM_VSM_SIM_START |
This event is sent on
simulation start-up or restart. |
WM_VSM_SNAP_STATE |
Signals a user-request to snap system states; that is, set the initial condition to the current state value. |
WM_VSM_STOP_SIM |
Signals that Embed has
stopped, either by user or time
expiration. |
WM_VSM_SUPPRESS_WARN_UNCONNECT |
Checks to suppress the
unconnected input warning message. Return 1 if suppression is
desired. |
WM_VSM_WINDOW_HANDLE |
This event is generated on
Embed start-up. |