My Project
|
CAutoUpdaterClietn also implements a dummy INPL Runtime state, so that it can receive call back from the autoupdater.dll activation. More...
#include <AutoUpdaterClient.h>
Public Member Functions | |
virtual void | SetUpdaterDllPath (const char *sDllPath=NULL) |
set the autoupdater.dll file path More... | |
virtual void | ActivateAutoUpdater (const std::string &sMsg) |
call the auto updater. More... | |
virtual int | BeginUpdate (const std::string &curVersion, const char *sUpdaterName=NULL) |
begin updating the application. More... | |
virtual void | OnProgress (AutoUpdaterProgress eventType, const char *msg=NULL, int finishcount=0, int allcount=0) |
on progress | |
virtual void | OnMessageCallback (NPLInterface::NPLObjectProxy &msg) |
this function is called whenever we receive a message. More... | |
virtual AutoUpdaterProgress | WaitForCompletion (IAutoUpdaterCallback *pCallback=0) |
this function returns until auto updater is finished. More... | |
virtual bool | GetUpdaterMessage (ProgressMessage &msg) |
Get a progress message from the queue. More... | |
virtual bool | PeekUpdaterMessage (ProgressMessage &msg) |
Peek a progress message from the queue. More... | |
virtual void | ExitUpdater () |
join all threads and unload dll. More... | |
virtual void | ApplyPatch () |
apply the recently downloaded patch | |
virtual const std::string & | GetName () const |
return the name of this runtime state. More... | |
virtual int | activate (const char *sNPLFilename, const char *sCode, int nCodeLength=0, int priority=2, int reliability=4) |
activate the specified file. More... | |
virtual NPLReturnCode | Activate_async (const std::string &filepath, const char *code=NULL, int nLength=0, int priority=0) |
activate the specified file in this runtime state. More... | |
virtual NPLReturnCode | ActivateLocal (const char *filepath, const char *code=NULL, int nLength=0, int priority=0) |
same as Activate_async, except that it is a short cut name. More... | |
virtual NPLReturnCode | Activate_async (NPLMessage_ptr &msg, int priority=0) |
same as Activate_async. More... | |
virtual NPLReturnCode | SendMessage (NPLMessage_ptr &msg, int priority=0) |
send a message to the current message queue. More... | |
virtual const char * | GetCurrentMsg () |
get a pointer to the current message | |
virtual int | GetCurrentMsgLength () |
get length of the current message | |
virtual INPLRuntime * | GetNPLRuntime () |
get the NPL runtime environment | |
virtual void | WriteLog (const char *text, int nTextLen=0, int nLogType=0) |
write a log message More... | |
virtual bool | SetTimer (int nIDEvent, float fElapse, const char *sNeuronFile) |
creates a timer with the specified time-out value [thread safe] More... | |
virtual bool | KillTimer (int nIDEvent) |
Destroys the specified timer [thread safe]. More... | |
virtual bool | ChangeTimer (int nIDEvent, int dueTime, int period) |
Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals. More... | |
virtual void | SetUpdateUrl (const std::string &updateurl) |
set the update url. More... | |
virtual void | RegisterFile (const char *sFilename, INPLActivationFile *pFileHandler=NULL) |
function to register the a file handler in the current NPL state, so that it is callable from NPL script or C++ More... | |
virtual void | call (const char *sNPLFilename, const char *sCode, int nCodeLength=0) |
synchronous function call | |
![]() | |
virtual void | OnProgress (AutoUpdaterProgress eventType, const char *msg=NULL, int finishcount=0, int allcount=0)=0 |
This function is called for update progress. | |
Protected Attributes | |
const char * | m_current_msg |
pointer to the current message. More... | |
int | m_current_msg_length |
length of the current message. More... | |
std::string | m_name |
the name of this runtime state. More... | |
std::string | m_updateurl |
get update url | |
ParaEngine::CPluginLoader | m_auto_updater_plugin |
the Auto updater plugin | |
AutoUpdaterProgress | m_progress_status |
ParaEngine::Mutex | m_mutex |
ParaEngine::Semaphore | m_semaphore |
std::queue< ProgressMessage > | m_msgs |
all messages | |
std::string | m_session_dir |
the directory where the downloaded core update files are cached. More... | |
std::string | m_sApplyPatchMsg |
apply patch message | |
std::string | m_updater_plugin_path |
autoupdater.dll file path. More... | |
IAutoUpdaterCallback * | m_pUpdaterCallback |
Additional Inherited Members | |
![]() | |
enum | AutoUpdaterProgress { AUP_NOT_STARTED, AUP_STARTED, AUP_NOCHANGE, AUP_UNKNOWN, AUP_BROKENFILE, AUP_ERROR, AUP_PROGRESS, AUP_COMPLETED, AUP_DO_APPLY_PATCH } |
auto update progress | |
CAutoUpdaterClietn also implements a dummy INPL Runtime state, so that it can receive call back from the autoupdater.dll activation.
|
virtual |
activate the specified file.
It can either be local or remote file.
Implements NPL::INPLRuntimeState.
|
virtual |
activate the specified file in this runtime state.
the file can be script or DLL. The function will just insert the message into the message queue and return immediately.
code | it is a chunk of code that should be executed in the destination neuron. this code usually set the values of POL global variables. |
nLength | the code length. if this is 0, length is determined from code, however, it must not exceed 4096 bytes. if it is specified. it can be any code length |
priority | bigger is higher. 0 is the default. if 1, it will be inserted to the front of the queue. |
Implements NPL::INPLRuntimeState.
|
virtual |
same as Activate_async.
except that input are read from NPLMesage. e.g. NPLMessage_ptr msg(new NPLMessage()); return Activate_async(msg, priority);
msg | the caller is should only new but never delete the NPLMessage_ptr. And that the message must be created in the same thread, usually just before calling this function |
Implements NPL::INPLRuntimeState.
|
virtual |
call the auto updater.
Implements NPL::IAutoUpdaterClient.
|
virtual |
same as Activate_async, except that it is a short cut name.
and may be used by external dlls to activate a file on this local state asynchrounously.
Implements NPL::INPLRuntimeState.
|
virtual |
begin updating the application.
Implements NPL::IAutoUpdaterClient.
|
inlinevirtual |
Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.
[thread safe]
nIDEvent | Specifies the timer to be destroyed.For nIDEvent<=0, they are reserved for internal uses can not be killed by this function. This value must be the same as the nIDEvent value passed to the SetTimer function that created the timer. |
dueTime | The amount of time to delay before the invoking the callback method specified when the Timer was constructed, in milliseconds. Specify zero (0) to restart the timer immediately. however, the current implementation does not accept dueTime that is larger than MAX_TIMER_DUE_TIME 10000000, which is 10000 seconds. |
period:The | time interval between invocations of the callback method specified when the Timer was constructed, in milliseconds. |
Implements NPL::INPLRuntimeState.
|
virtual |
join all threads and unload dll.
This function is automatically called when the interface is cleaned up.
Implements NPL::IAutoUpdaterClient.
|
virtual |
return the name of this runtime state.
if "", it is considered an anonymous name
Implements NPL::INPLRuntimeState.
|
virtual |
Get a progress message from the queue.
This function will block until a message arrive, much like the Win32 API.
Implements NPL::IAutoUpdaterClient.
|
inlinevirtual |
Destroys the specified timer [thread safe].
nIDEvent | Specifies the timer to be destroyed.For nIDEvent<=0, they are reserved for internal uses can not be killed by this function. This value must be the same as the nIDEvent value passed to the SetTimer function that created the timer. |
Implements NPL::INPLRuntimeState.
|
virtual |
this function is called whenever we receive a message.
Implements NPL::IAutoUpdaterClient.
|
virtual |
Peek a progress message from the queue.
This function will return false if there is no message in the queue, much like the Win32 API.
Implements NPL::IAutoUpdaterClient.
|
virtual |
function to register the a file handler in the current NPL state, so that it is callable from NPL script or C++
sFilename | any name with cpp file extension can be used. usually it is "states.cpp". The name does not need to be same as the real cpp file. |
pFileHandler | if NULL it will unregister. If not, it is the file handler pointer, the pointer must be always valid, it is usually a static singleton object. |
Implements NPL::INPLRuntimeState.
|
virtual |
send a message to the current message queue.
This function is rarely needed to call directly, use Activate_async instead. e.g. NPLMessage_ptr msg(new NPLMessage()); return SendMessage(msg, priority);
msg | the message to send. Please note that when the function returns, the msg will be reset to null. |
Implements NPL::INPLRuntimeState.
|
inlinevirtual |
creates a timer with the specified time-out value [thread safe]
nIDEvent | Specifies a positive timer identifier. For nIDEvent<=0, they are reserved for internal uses. If the NPL runtime already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. |
fElapse | Specifies the time-out value, in seconds. Please note that a timer will not be repeatedly activated if its timeout is shorter than the frame rate of the NPL simulation pipeline . |
sNeuronFile | The NPL file to be activated when the time-out value elapses. For more information about the file name See NPL.activate(). |
Implements NPL::INPLRuntimeState.
|
virtual |
set the autoupdater.dll file path
sDllPath | if not set, it will default to "AutoUpdater.dll" in the current working directory. |
Implements NPL::IAutoUpdaterClient.
|
virtual |
set the update url.
|
virtual |
this function returns until auto updater is finished.
Implements NPL::IAutoUpdaterClient.
|
virtual |
write a log message
text | the content of the log message. |
nTextLen | the log text length in byte. if 0, text length will be determined automatically. |
nLogType | if this is 0, it is a normal log message. if this is 1, we will print current time, and runtime state name with the log message. |
Implements NPL::INPLRuntimeState.
|
protected |
pointer to the current message.
it is only valid during activation call. NULL will be returned
|
protected |
length of the current message.
it is only valid during activation call.
|
protected |
the name of this runtime state.
if "", it is considered an anonymous name
|
protected |
the directory where the downloaded core update files are cached.
|
protected |
autoupdater.dll file path.