Skip to content

Commit

Permalink
Update task, workflow and dictionary interfaces for DIRECT 7.2.76.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Aug 20, 2024
1 parent 4fa7466 commit d01b1f6
Show file tree
Hide file tree
Showing 6 changed files with 737 additions and 777 deletions.
843 changes: 410 additions & 433 deletions dictionaryi.h

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions interoplib.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,9 @@ bool Base64_Encode(const uint8_t *Source, int32_t SourceLength, char *Target, in
return true;
}

bool Base64_CalculateEncodeSize(int32_t SourceLength, int32_t *BytesRequired) {
// Round up to the nearest multiple of 4.
*BytesRequired = (SourceLength + 2) / 3 * 4;

// Include NULL terminator
*BytesRequired += 1;

return true;
int32_t Base64_CalculateEncodeSize(int32_t source_length) {
// Round up to the nearest multiple of 4 and include NULL terminator
return ((source_length + 2) / 3 * 4) + 1;
}

/*********************************************************************/
Expand Down
56 changes: 29 additions & 27 deletions interoplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,50 @@ typedef struct ClassStruct {

/*********************************************************************/

bool String_ConvertToHex(const uint8_t *Binary, int32_t BinarySize, bool Lower, char *Hex, int32_t MaxHex);
bool String_ConvertToHex(const uint8_t *binary, int32_t binary_size, bool lower, char *hex, int32_t max_hex);

/*********************************************************************/

bool Base64_Encode(const uint8_t *Source, int32_t SourceLength, char *Target, int32_t MaxTarget, int32_t *TargetLength);
bool Base64_CalculateEncodeSize(int32_t SourceLength, int32_t *BytesRequired);
bool Base64_Encode(const uint8_t *source, int32_t source_length, char *target, int32_t max_target,
int32_t *target_length);
int32_t Base64_CalculateEncodeSize(int32_t source_length);

/*********************************************************************/

typedef bool (*Generic_LogCallback)(echandle LogHandle, const char *Format, ...);
typedef bool (*Generic_LogCallback)(echandle log_handle, const char *format, ...);

/*********************************************************************/

typedef bool (*NotificationCenter_ObserverCallback)(void *UserPtr, const char *Type, const char *Notification,
const char *Sender, echandle DictionaryHandle);
typedef bool (*NotificationCenter_ObserverCallback)(void *user_ptr, const char *type, const char *notification,
const char *sender, echandle dictionary_handle);

/*********************************************************************/

void *Class_ConvertFromInstanceId(const char *InstanceId);
char *Class_ConvertToInstanceId(void *Pointer);
bool Class_TrackInstance(void *Pointer, const char *InstanceId);
bool Class_UntrackInstance(void *Pointer);
void *Class_ConvertFromInstanceId(const char *instance_id);
char *Class_ConvertToInstanceId(void *pointer);
bool Class_TrackInstance(void *pointer, const char *instance_id);
bool Class_UntrackInstance(void *pointer);

echandle Dictionary_Create(void);
int32_t Dictionary_Release(echandle *DictionaryHandle);

bool NotificationCenter_AddObserver(const char *Type, const char *Notification, void *UserPtr,
NotificationCenter_ObserverCallback Callback);
bool NotificationCenter_AddInstanceObserver(const char *Type, const char *Notification, const char *Sender,
void *UserPtr, NotificationCenter_ObserverCallback Callback);
bool NotificationCenter_RemoveObserver(const char *Type, const char *Notification, void *UserPtr,
NotificationCenter_ObserverCallback Callback);
bool NotificationCenter_RemoveInstanceObserver(const char *Type, const char *Notification, const char *Sender,
void *UserPtr, NotificationCenter_ObserverCallback Callback);
bool NotificationCenter_Fire(const char *Type, const char *Notification, const char *Sender, echandle DictionaryHandle);
bool NotificationCenter_FireWithJSON(const char *Type, const char *Notification, const char *Sender, const char *Format,
int32_t Dictionary_Release(echandle *dictionary_handle);

bool NotificationCenter_AddObserver(const char *type, const char *notification, void *user_ptr,
NotificationCenter_ObserverCallback callback);
bool NotificationCenter_AddInstanceObserver(const char *type, const char *notification, const char *sender,
void *user_ptr, NotificationCenter_ObserverCallback callback);
bool NotificationCenter_RemoveObserver(const char *type, const char *notification, void *user_ptr,
NotificationCenter_ObserverCallback callback);
bool NotificationCenter_RemoveInstanceObserver(const char *type, const char *notification, const char *sender,
void *user_ptr, NotificationCenter_ObserverCallback callback);
bool NotificationCenter_Fire(const char *type, const char *notification, const char *sender,
echandle dictionary_handle);
bool NotificationCenter_FireWithJSON(const char *type, const char *notification, const char *sender, const char *format,
...);
bool NotificationCenter_FireAfterDelay(const char *Type, const char *Notification, const char *Sender, int32_t DelayMS,
echandle DictionaryHandle);
bool NotificationCenter_FireAfterDelayWithJSON(const char *Type, const char *Notification, const char *Sender,
int32_t DelayMS, const char *Format, ...);
bool Interop_GenerateInstanceId(char *String, int32_t MaxString);
bool NotificationCenter_FireAfterDelay(const char *type, const char *notification, const char *sender, int32_t delay_ms,
echandle dictionary_handle);
bool NotificationCenter_FireAfterDelayWithJSON(const char *type, const char *notification, const char *sender,
int32_t delay_ms, const char *format, ...);
bool Interop_GenerateInstanceId(char *string, int32_t max_string);

/*********************************************************************/

Expand Down
50 changes: 25 additions & 25 deletions interopstub.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,48 @@ extern "C" {

/*********************************************************************/

typedef bool (*Interop_ExecuteCallback)(void *UserPtr, const char *InstanceId, echandle MethodDictionaryHandle,
echandle ReturnDictionaryHandle);
typedef int32_t (*Interop_ReleaseInstanceCallback)(void **UserPtr);
typedef bool (*Interop_InvokeInstanceCallback)(void *UserPtr, echandle MethodDictionaryHandle,
echandle ReturnDictionaryHandle);
typedef bool (*Interop_ProcessInstanceCallback)(void *UserPtr);
typedef bool (*Interop_ExecuteCallback)(void *user_ptr, const char *instance_id, const char *string);
typedef int32_t (*Interop_ReleaseInstanceCallback)(void **user_ptr);
typedef bool (*Interop_InvokeInstanceCallback)(void *user_ptr, echandle method_dictionary_handle,
echandle return_dictionary_handle);
typedef bool (*Interop_ProcessInstanceCallback)(void *user_ptr);

/*********************************************************************/

/*!
* Called when an instance is created
* \param TypeName type of object to be created
* \param InstanceId id of the object to be created
* \param InstanceIdLength maximum length of the InstanceId
* \param ExecuteUserPtr user pointer stored with execute callback
* \param Execute execute callback
* \param Invoke pointer to the instance invocation callback function
* \param Release pointer to the instance release/delete callback function
* \param Process pointer to the instance process callback function
* \param UserPtr pointer associated with instance id
* \param type_name type of object to be created
* \param instance_id id of the object to be created
* \param instance_id_length maximum length of the InstanceId
* \param execute_user_ptr user pointer stored with execute callback
* \param execute execute callback
* \param invoke_instance pointer to the instance invocation callback function
* \param release_instance pointer to the instance release/delete callback function
* \param process_instance pointer to the instance process callback function
* \param user_ptr pointer associated with instance id
* \return true on success, false otherwise
*/
bool Interop_CreateInstance(const char *TypeName, char *InstanceId, int32_t InstanceIdLength, void *ExecuteUserPtr,
Interop_ExecuteCallback Execute, Interop_InvokeInstanceCallback *Invoke,
Interop_ReleaseInstanceCallback *Release, Interop_ProcessInstanceCallback *Process,
void **UserPtr);
bool Interop_CreateInstance(const char *type_name, char *instance_id, int32_t instance_id_length,
void *execute_user_ptr, Interop_ExecuteCallback execute,
Interop_InvokeInstanceCallback *invoke_instance,
Interop_ReleaseInstanceCallback *release_instance,
Interop_ProcessInstanceCallback *process_instance, void **user_ptr);

/*!
* Set an interop function to override by key
* \param Key identifier of option
* \param Value pointer to the function
* \param key identifier of option
* \param value pointer to the function
* \return true on success, false otherwise
*/
bool Interop_SetOverride(const char *Key, void *Value);
bool Interop_SetOverride(const char *key, void *value);

/*!
* Set an interop option by key
* \param Key identifier of option
* \param Value value of option
* \param key identifier of option
* \param value value of option
* \return true on success, false otherwise
*/
bool Interop_SetOption(const char *Key, void *Value);
bool Interop_SetOption(const char *key, void *value);

/*!
* Loads interop functions
Expand Down
Loading

0 comments on commit d01b1f6

Please sign in to comment.