Minor Update:

- DeviceCore:
  Issue event with DataPath, not param name
This commit is contained in:
Charl Wentzel
2019-07-12 08:54:06 +02:00
parent 5f0c963da7
commit 91a7707fef

View File

@@ -1764,6 +1764,8 @@ int CDeviceCore::HandleCommand( const char *ChannelName, const char * SourceRef,
// Generate Event output // Generate Event output
bool CDeviceCore::EventOutput( TDeviceParam * Param, bool Force ) bool CDeviceCore::EventOutput( TDeviceParam * Param, bool Force )
{ {
char Message[200];
// Validate // Validate
if (!Param || !(Param->EventChannel)) if (!Param || !(Param->EventChannel))
return false; return false;
@@ -1773,38 +1775,37 @@ bool CDeviceCore::EventOutput( TDeviceParam * Param, bool Force )
(Param->EventInterval && Timeout( Param->EventTimeout, Param->EventInterval )) ) (Param->EventInterval && Timeout( Param->EventTimeout, Param->EventInterval )) )
{ {
// Post event // Post event
char Message[200];
switch (Param->DataType) switch (Param->DataType)
{ {
case dtBool : case dtBool :
sprintf( Message, "%s: %u\n", Param->Name, *((bool*)Param->Value) ); sprintf( Message, "%s: %u\n", Param->DataPath, *((bool*)Param->Value) );
break; break;
case dtUnsigned16 : case dtUnsigned16 :
sprintf( Message, "%s: %u\n", Param->Name, *((u_int16_t*)Param->Value) ); sprintf( Message, "%s: %u\n", Param->DataPath, *((u_int16_t*)Param->Value) );
break; break;
case dtUnsigned32_HL : case dtUnsigned32_HL :
case dtUnsigned32_LH : case dtUnsigned32_LH :
sprintf( Message, "%s: %u\n", Param->Name, *((u_int32_t*)Param->Value) ); sprintf( Message, "%s: %u\n", Param->DataPath, *((u_int32_t*)Param->Value) );
break; break;
case dtSigned16 : case dtSigned16 :
sprintf( Message, "%s: %d\n", Param->Name, *((int16_t*)Param->Value) ); sprintf( Message, "%s: %d\n", Param->DataPath, *((int16_t*)Param->Value) );
break; break;
case dtSigned32_HL : case dtSigned32_HL :
case dtSigned32_LH : case dtSigned32_LH :
sprintf( Message, "%s: %d\n", Param->Name, *((int32_t*)Param->Value) ); sprintf( Message, "%s: %d\n", Param->DataPath, *((int32_t*)Param->Value) );
break; break;
case dtFloat32_L : case dtFloat32_L :
case dtFloat32_B : case dtFloat32_B :
sprintf( Message, "%s: %f\n", Param->Name, *((float*)Param->Value) ); sprintf( Message, "%s: %f\n", Param->DataPath, *((float*)Param->Value) );
break; break;
case dtString : case dtString :
sprintf( Message, "%s: %s\n", Param->Name, (char*)Param->Value ); sprintf( Message, "%s: %s\n", Param->DataPath, (char*)Param->Value );
break; break;
default : default :