Skip to content

Commit

Permalink
Add Media Playback Cluster
Browse files Browse the repository at this point in the history
Problem
We do not have media playback cluster which is needed for Chip to control media on TV

Summary of Changes
- Added Media Playback cluster.xml file
- Added Media Playback client and server.cpp files
- Updated example chip-tool so you can use media playback cluster
- Created example tv-app so you can start a TV server
  • Loading branch information
lazarkov committed Feb 16, 2021
1 parent aa7c8ec commit 0503b38
Show file tree
Hide file tree
Showing 79 changed files with 42,205 additions and 70 deletions.
1 change: 1 addition & 0 deletions examples/all-clusters-app/all-clusters-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ source_set("all-clusters-common") {
"${chip_root}/src/app/clusters/ias-zone-server/ias-zone-server.cpp",
"${chip_root}/src/app/clusters/identify/identify.cpp",
"${chip_root}/src/app/clusters/level-control/level-control.cpp",
"${chip_root}/src/app/clusters/media-playback-server/media-playback-server.cpp",
"${chip_root}/src/app/clusters/on-off-server/on-off.cpp",
"${chip_root}/src/app/clusters/scenes/scenes.cpp",
"${chip_root}/src/app/clusters/temperature-measurement-server/temperature-measurement-server.cpp",
Expand Down
245 changes: 201 additions & 44 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"writeTime": "Mon Feb 15 2021 16:34:42 GMT+0100 (Central European Standard Time)",
"writeTime": "Tue Feb 16 2021 18:22:03 GMT+0100 (Central European Standard Time)",
"featureLevel": 11,
"creator": "zap",
"keyValuePairs": [
Expand Down Expand Up @@ -79,6 +79,7 @@
"define": "BASIC_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
Expand Down Expand Up @@ -125,8 +126,7 @@
"maxInterval": 65344,
"reportableChange": 0
}
],
"commands": []
]
},
{
"name": "Identify",
Expand Down Expand Up @@ -377,6 +377,23 @@
"define": "SCENES_CLUSTER",
"side": "client",
"enabled": 0,
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "3",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
],
"commands": [
{
"name": "AddScene",
Expand Down Expand Up @@ -434,23 +451,6 @@
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "3",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
Expand Down Expand Up @@ -793,7 +793,6 @@
"define": "LEVEL_CONTROL_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
Expand Down Expand Up @@ -825,7 +824,8 @@
"maxInterval": 65344,
"reportableChange": 0
}
]
],
"commands": []
},
{
"name": "Door Lock",
Expand Down Expand Up @@ -1045,24 +1045,6 @@
"define": "DOOR_LOCK_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [
{
"name": "LockDoorResponse",
"code": 0,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
},
{
"name": "UnlockDoorResponse",
"code": 1,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
Expand Down Expand Up @@ -1499,6 +1481,24 @@
"maxInterval": 65344,
"reportableChange": 0
}
],
"commands": [
{
"name": "LockDoorResponse",
"code": 0,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
},
{
"name": "UnlockDoorResponse",
"code": 1,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
}
]
},
{
Expand Down Expand Up @@ -2552,7 +2552,6 @@
"define": "TEMP_MEASUREMENT_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
Expand All @@ -2569,7 +2568,8 @@
"maxInterval": 65344,
"reportableChange": 0
}
]
],
"commands": []
},
{
"name": "Temperature Measurement",
Expand Down Expand Up @@ -4340,6 +4340,7 @@
"define": "BARRIER_CONTROL_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "cluster revision",
Expand Down Expand Up @@ -4416,8 +4417,7 @@
"maxInterval": 65344,
"reportableChange": 0
}
],
"commands": []
]
},
{
"name": "Color Control",
Expand Down Expand Up @@ -5667,6 +5667,163 @@
"reportableChange": 0
}
]
},
{
"name": "Media Playback",
"code": 61441,
"mfgCode": null,
"define": "MEDIA_PLAYBACK_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "PlayRequest",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "PauseRequest",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "StopRequest",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "StartOverRequest",
"code": 3,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "PreviousRequest",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "NextRequest",
"code": 5,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "RewindRequest",
"code": 6,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "FastForwardRequest",
"code": 7,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "SkipForwardRequest",
"code": 8,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
},
{
"name": "SkipBackwardRequest",
"code": 9,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Media Playback",
"code": 61441,
"mfgCode": null,
"define": "MEDIA_PLAYBACK_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [
{
"name": "Playback",
"code": 0,
"mfgCode": null,
"source": "server",
"incoming": 1,
"outgoing": 1
}
],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "current state",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,32 @@ NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN

@interface CHIPMediaPlayback : NSObject

- (nullable instancetype)initWithDevice:(CHIPDevice *)device endpoint:(uint8_t)endpoint queue:(dispatch_queue_t)queue;
- (BOOL)fastForwardRequest:(ResponseHandler)completionHandler;
- (BOOL)nextRequest:(ResponseHandler)completionHandler;
- (BOOL)pauseRequest:(ResponseHandler)completionHandler;
- (BOOL)playRequest:(ResponseHandler)completionHandler;
- (BOOL)previousRequest:(ResponseHandler)completionHandler;
- (BOOL)rewindRequest:(ResponseHandler)completionHandler;
- (BOOL)skipBackwardRequest:(ResponseHandler)completionHandler;
- (BOOL)skipForwardRequest:(ResponseHandler)completionHandler;
- (BOOL)startOverRequest:(ResponseHandler)completionHandler;
- (BOOL)stopRequest:(ResponseHandler)completionHandler;

- (BOOL)readAttributeCurrentState:(ResponseHandler)completionHandler;
- (BOOL)readAttributeClusterRevision:(ResponseHandler)completionHandler;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN

@interface CHIPOnOff : NSObject

- (nullable instancetype)initWithDevice:(CHIPDevice *)device endpoint:(uint8_t)endpoint queue:(dispatch_queue_t)queue;
Expand Down
Loading

0 comments on commit 0503b38

Please sign in to comment.