25
25
26
26
using namespace chip ::app::Clusters::Actions;
27
27
28
- Device::Device (const char * szDeviceName, std::string szLocation )
28
+ Device::Device (chip::NodeId nodeId, const char * name )
29
29
{
30
- chip::Platform::CopyString (mName , szDeviceName);
31
- mLocation = szLocation;
30
+ chip::Platform::CopyString (mName , name);
32
31
mReachable = false ;
33
32
mEndpointId = 0 ;
34
33
}
@@ -38,37 +37,23 @@ bool Device::IsReachable()
38
37
return mReachable ;
39
38
}
40
39
41
- void Device::SetReachable (bool aReachable )
40
+ void Device::SetReachable (bool reachable )
42
41
{
43
- bool changed = ( mReachable != aReachable) ;
42
+ mReachable = reachable ;
44
43
45
- mReachable = aReachable;
46
-
47
- if (aReachable)
44
+ if (reachable)
48
45
{
49
46
ChipLogProgress (NotSpecified, " Device[%s]: ONLINE" , mName );
50
47
}
51
48
else
52
49
{
53
50
ChipLogProgress (NotSpecified, " Device[%s]: OFFLINE" , mName );
54
51
}
55
-
56
- if (changed)
57
- {
58
- HandleDeviceChange (this , kChanged_Reachable );
59
- }
60
52
}
61
53
62
- void Device::SetName (const char * szName )
54
+ void Device::SetName (const char * name )
63
55
{
64
- bool changed = ( strncmp ( mName , szName, sizeof ( mName )) != 0 );
56
+ ChipLogProgress (NotSpecified, " Device[%s]: New Name= \" %s \" " , mName , name );
65
57
66
- ChipLogProgress (NotSpecified, " Device[%s]: New Name=\" %s\" " , mName , szName);
67
-
68
- chip::Platform::CopyString (mName , szName);
69
-
70
- if (changed)
71
- {
72
- HandleDeviceChange (this , kChanged_Name );
73
- }
58
+ chip::Platform::CopyString (mName , name);
74
59
}
0 commit comments