Other Parts Discussed in Thread: CC2538
ZHA Coordinator 如何控制不同scene的Light,
灯有几种scene,协调器如何控制灯在不同的scene之间切换?
协调器 zstack home 1.2.2 CC2538
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: CC2538
ZHA Coordinator 如何控制不同scene的Light,
灯有几种scene,协调器如何控制灯在不同的scene之间切换?
协调器 zstack home 1.2.2 CC2538
协调器去控制灯,协调器代码添加如下:
第一步:
if ( keys == GROUP_ADD_KEY )
{
uint8 emptyGroupName[2] = {0};
if ( groupSelId == 0 )
{
groupSelId = 1;
}
zclGeneral_SendGroupAdd( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr, groupSelId,
emptyGroupName, FALSE, sampleRemoteSeqNum++ );
}
第二步:
if ( keys == GROUP_1_SEL_KEY )
{
zllSampleRemote_DstAddr.addr.shortAddr = 1;
groupSelId = 1;
zllSampleRemote_DstAddr.addrMode = (afAddrMode_t)AddrGroup;
zclGeneral_SendIdentify( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr,
SAMPLEREMOTE_CMD_IDENTIFY_TIME, FALSE, sampleRemoteSeqNum++ );
}
第三步:
if ( keys == SCENE_1_SEL_KEY )
{
sceneSelId = 1;
if ( ( RELEASE_KEY ) && ( !SCENE_RECALL_KEY ) )
{
sceneKeyPressTime = osal_getClock();
}
}
最后:
if ( keys == SCENE_STORE_KEY )
{
if ( groupSelId == 0 )
{
groupSelId = 1;
}
zclGeneral_SendSceneStore( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr,
groupSelId, sceneSelId,
FALSE, sampleRemoteSeqNum++ );
}
if ( keys == SCENE_RECALL_KEY )
{
if ( groupSelId == 0 )
{
groupSelId = 1;
}
zclGeneral_SendSceneRecall( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr,
groupSelId, sceneSelId,
FALSE, sampleRemoteSeqNum++ );
}
这个步骤对吗?另外请问SCENE_STORE和SCENE_RECALL是什么区别?
灯里面预设了6个场景,协调器只要发送任意一个场景的编号,灯就会根据编号自动切换到相应的场景
如果是這樣,我猜你只要用zclGeneral_SendSceneRecall去发送任意一个场景的编号就可以
{
uint16 timeDiff = ( osal_getClock() - sceneKeyPressTime );
sceneKeyPressTime = 0;
#ifdef SAMPLEREMOTE_UNIQUE_GROUP
zllSampleRemote_DstAddr.addr.shortAddr = controlledGroups.arr[0];
groupSelId = controlledGroups.arr[0];
zllSampleRemote_DstAddr.addrMode = (afAddrMode_t)AddrGroup;
#endif //SAMPLEREMOTE_UNIQUE_GROUP
if ( timeDiff < 3 )
{
//short press : scene recall
zclGeneral_SendSceneRecall( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr,
groupSelId, sceneSelId, FALSE, sampleRemoteSeqNum++ );
}
else
{
//long press : scene store
zclGeneral_SendSceneStore( SAMPLEREMOTE_ENDPOINT, &zllSampleRemote_DstAddr,
groupSelId, sceneSelId, FALSE, sampleRemoteSeqNum++ );
#ifdef BUZZER_FEEDBACK
HalBuzzerRing( 300, NULL );
#endif
return;
}
你仔细看一下remote的程序,是组播没错,但是组地址不一样的,zllSampleRemote_addControlledGroup中的一致。