Author: Not specified Language: cpp
Description: Not specified Timestamp: 2017-01-29 23:15:43 +0000
View raw paste Reply
void CNetExample::RpmUpdate()
{
    printf("Motor RPM has been updated. RPM = [%f]", motorRpm->GetValue());
}

bool CNetExample::Initialize()
{
    // Define Net Types
    motorRpm = CreateFloat("motorRpm");
    motorRpm->InitializeNet("machine.motor.rpm");

    // Use EVENT_HANDLER macro with RegisterEvent(delegate) to define an async
    // event handler for motor rpm updates.
    motorRpm->RegisterEvent(EVENT_HANDLER(RpmUpdate));

    motorTarget = CreateFloat("targetRpm");
    motorTarget->InitializeNet("machine.motor.vfd.target");

    // Write update without needing to know how to connect to the target device.
    motorTarget->SetValue(58.3);
   
    return true;
}
View raw paste Reply