193250d172612c405135d56ffd306deae5ebc6df1Kevin Rocard/*
2b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * Copyright (c) 2011-2014, Intel Corporation
3b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * All rights reserved.
46ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli *
5b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * Redistribution and use in source and binary forms, with or without modification,
6b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * are permitted provided that the following conditions are met:
76ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli *
8b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 1. Redistributions of source code must retain the above copyright notice, this
9b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * list of conditions and the following disclaimer.
106ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli *
11b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 2. Redistributions in binary form must reproduce the above copyright notice,
12b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * this list of conditions and the following disclaimer in the documentation and/or
13b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * other materials provided with the distribution.
14b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner *
15b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 3. Neither the name of the copyright holder nor the names of its contributors
16b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * may be used to endorse or promote products derived from this software without
17b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * specific prior written permission.
18b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner *
19b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
296ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli */
306ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli#include "VirtualSyncer.h"
316ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli#include "ConfigurableElement.h"
326ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli#include "ParameterAccessContext.h"
336ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli
34d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalveusing std::string;
35d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve
369368eea42a1afb01dd44110582f997115b50e742François GaffieCVirtualSyncer::CVirtualSyncer(const CConfigurableElement *pConfigurableElement)
379368eea42a1afb01dd44110582f997115b50e742François Gaffie    : _pConfigurableElement(pConfigurableElement)
386ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli{
396ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli}
406ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli
416ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli// Synchronization
429368eea42a1afb01dd44110582f997115b50e742François Gaffiebool CVirtualSyncer::sync(CParameterBlackboard &parameterBlackboard, bool bBack, string &strError)
436ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli{
446ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli    // Synchronize to/from HW
456ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli    if (bBack) {
466ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli        // Create access context
479368eea42a1afb01dd44110582f997115b50e742François Gaffie        CParameterAccessContext parameterAccessContext(strError, &parameterBlackboard);
486ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli
496ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli        // Just implement back synchronization with default values
506ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli        _pConfigurableElement->setDefaultValues(parameterAccessContext);
516ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli    }
526ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli
536ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli    return true;
546ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli}
55