AudioScience HPI Version_4.24.1
|
The Lua block is used for manipulating a lua script that can run on the device. More...
The Lua block is used for manipulating a lua script that can run on the device.
The Lua block is an implementation of a universal control (see Universal Control).
The list of supported datatypes is as follows:
ASCII character.
Sequence of potentially heterogeneous entities.
Conceptually similar to C struct.
Lua |
Lua block parameters implement a Lua subsystem on the device |
Script State |
Sets the state of the lua scripting engine |
Source Filename |
The name of the Lua source file |
Source Timestamp |
The ISO8601 formated timestamp of the Lua source file |
Bytecode Filename |
The name of the Lua bytecode file |
Bytecode Timestamp |
The ISO8601 formated timestamp of the Lua bytecode file |
Messages |
Messages from Lua runtime |
Name | Lua |
Description | Lua block parameters implement a Lua subsystem on the device. |
Optional | No |
Type | sequence / entity_type_sequence / a sequence of parameters follow |
Count | 6 |
Attributes | read |
Added in version | future |
Example | static void print_block_control( hpi_hsubsys_t *hSubSys, hpi_handle_t hMixer, hpi_handle_t hControl ) { enum e_entity_role r; hpi_err_t err; char name[256]; size_t size, items; int count; err = HPI_Object_GetRole(hControl, &r); if (err) HandleError(err); // name size = sizeof(name); err = HPI_Object_GetInfo( hControl, entity_type_cstring, entity_role_classname, name, &size, &items); if (err) HandleError(err); printf(" %s", name); // count size = sizeof(count); err = HPI_Object_GetInfo( hControl, entity_type_int, entity_role_value, &count, &size, &items); if (err) HandleError(err); printf(", count %d", count); // fetch parameter handles if ( r == entity_role_block ) { hpi_handle_t params[16]; /* should really use count */ int i; size_t number; printf(" ["); number = sizeof(params)/sizeof(hpi_handle_t); err = HPI_Object_BlockParameters( hMixer, hControl, params, &number); if (err) HandleError(err); for ( i=0 ; i<number ; i++ ) { if (i > 0) printf(", "); printf("%d",params[i]); } printf("]"); } } |
Name | Script State |
Description | Sets the state of the lua scripting engine. Valid enumeration strings are
Users should select the Running or Stopped state as required. The Run Pending state is entered whenever an IP address fails to resolve causing the Lua script to terminate. After 10 seconds the scripting engine will automatically transition to Running. |
Optional | No |
Type | enumerated / #entity_type_enumerated_strings / contains string enumerations |
Count | 1 |
Attributes | read/write |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; uint32_t Script_State; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Script State", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_int, entity_role_value, NULL, &value_size, &value_items); } Script_State = 1; /* TODO */ /* TODO */ /* TODO */ /* TODO */ err = HPI_Object_GetValue(param, entity_type_int, 1, &Script_State, sizeof(Script_State)); |
Name | Source Filename |
Description | The name of the Lua source file. |
Optional | No |
Type | cstring / entity_type_cstring / ASCII characters |
Count | HPI_SIZEOF_FLASH_FILE_HEADER_NAME |
Attributes | read volatile value |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; char Source_Filename[HPI_SIZEOF_FLASH_FILE_HEADER_NAME]; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Source Filename", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_cstring, entity_role_value, NULL, &value_size, &value_items); } err = HPI_Object_GetValue(param, entity_type_cstring, HPI_SIZEOF_FLASH_FILE_HEADER_NAME, &Source_Filename, sizeof(Source_Filename) ); printf("Source Filename: %s\n", Source_Filename); |
Name | Source Timestamp |
Description | The ISO8601 formated timestamp of the Lua source file |
Optional | No |
Type | cstring / entity_type_cstring / ASCII characters |
Count | HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP |
Attributes | read volatile value |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; char Source_Timestamp[HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP]; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Source Timestamp", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_cstring, entity_role_value, NULL, &value_size, &value_items); } err = HPI_Object_GetValue(param, entity_type_cstring, HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP, &Source_Timestamp, sizeof(Source_Timestamp) ); printf("Source Timestamp: %s\n", Source_Timestamp); |
Name | Bytecode Filename |
Description | The name of the Lua bytecode file. |
Optional | No |
Type | cstring / entity_type_cstring / ASCII characters |
Count | HPI_SIZEOF_FLASH_FILE_HEADER_NAME |
Attributes | read volatile value |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; char Bytecode_Filename[HPI_SIZEOF_FLASH_FILE_HEADER_NAME]; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Bytecode Filename", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_cstring, entity_role_value, NULL, &value_size, &value_items); } err = HPI_Object_GetValue(param, entity_type_cstring, HPI_SIZEOF_FLASH_FILE_HEADER_NAME, &Bytecode_Filename, sizeof(Bytecode_Filename) ); printf("Bytecode Filename: %s\n", Bytecode_Filename); |
Name | Bytecode Timestamp |
Description | The ISO8601 formated timestamp of the Lua bytecode file. |
Optional | No |
Type | cstring / entity_type_cstring / ASCII characters |
Count | HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP |
Attributes | read volatile value |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; char Bytecode_Timestamp[HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP]; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Bytecode Timestamp", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_cstring, entity_role_value, NULL, &value_size, &value_items); } err = HPI_Object_GetValue(param, entity_type_cstring, HPI_SIZEOF_FLASH_FILE_HEADER_TIMESTAMP, &Bytecode_Timestamp, sizeof(Bytecode_Timestamp) ); printf("Bytecode Timestamp: %s\n", Bytecode_Timestamp); |
Name | Messages |
Description | Messages from Lua runtime. |
Optional | No |
Type | cstring / entity_type_cstring / ASCII characters |
Count | sizeof(msg) |
Attributes | read volatile value |
Added in version | future |
Example | struct hpi_control_t asihpi_control; hpi_handle_t block; hpi_handle_t param; size_t value_size; size_t value_items; char Messages[sizeof(msg)]; /* set source and destination node */ asihpi_control.wSrcNodeType = HPI_SOURCENODE_ADAPTER; asihpi_control.wSrcNodeIndex = 0; asihpi_control.wDstNodeType = 0; asihpi_control.wDstNodeIndex = 0; err = HPI_Object_BlockHandle(hMixer, asihpi_control.wSrcNodeType, asihpi_control.wSrcNodeIndex, asihpi_control.wDstNodeType, asihpi_control.wDstNodeIndex, "Lua", &block ); err = HPI_Object_ParameterHandle( hMixer, block, "Messages", ¶m); if (!err) { err = HPI_Object_GetInfo( param, entity_type_cstring, entity_role_value, NULL, &value_size, &value_items); } err = HPI_Object_GetValue(param, entity_type_cstring, sizeof(msg), &Messages, sizeof(Messages) ); printf("Messages: %s\n", Messages); |