Skip to content

Commit

Permalink
fixing bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple committed Oct 29, 2024
1 parent 07deb34 commit d7ca8f0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 81 deletions.
54 changes: 0 additions & 54 deletions src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -468,62 +468,9 @@ - (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(N
for (NSDictionary * deviceInfo in deviceInfoList) {
if (!MTR_SAFE_CAST(deviceInfo, NSDictionary)) {
MTR_LOG_ERROR(" - Missing or malformed device Info");
}

NSNumber * nodeID = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationNodeIDKey], NSNumber);
if (!nodeID) {
MTR_LOG_ERROR(" - Missing or malformed nodeID");
continue;
}

NSDictionary * deviceInternalState = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationDeviceInternalStateKey], NSDictionary);
if (!deviceInternalState) {
MTR_LOG_ERROR(" - Missing or malformed deviceInternalState");
continue;
}

auto * device = static_cast<MTRDevice_XPC *>([self deviceForNodeID:nodeID]);
[device device:nodeID internalStateUpdated:deviceInternalState];
}
}

// TODO: Create DeviceControllerRunningState that is a tri-state with "unknown", "not running", and "running" states
- (BOOL)isRunning
{
// For XPC controller, always return yes
return YES;
}

- (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(NSDictionary *)configuration
{
// Reuse the same format as config dictionary, and add values for internal states
// @{
// MTRDeviceControllerRegistrationControllerContextKey: @{
// MTRDeviceControllerRegistrationControllerNodeIDKey: controllerNodeID
// }
// MTRDeviceControllerRegistrationNodeIDsKey: @[
// @{
// MTRDeviceControllerRegistrationNodeIDKey: nodeID,
// MTRDeviceControllerRegistrationDeviceInternalStateKey: deviceInternalStateDictionary
// }
// ]
// }

NSDictionary * controllerContext = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationControllerContextKey], NSDictionary);
NSNumber * controllerNodeID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey], NSNumber);
if (controllerNodeID && controllerNodeID) {
_controllerNodeID = controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey];
}

NSArray * deviceInfoList = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationNodeIDsKey], NSArray);

MTR_LOG("Received controllerConfigurationUpdated: controllerNode ID %@ deviceInfoList %@", self.controllerNodeID, deviceInfoList);

for (NSDictionary * deviceInfo in deviceInfoList) {
if (!MTR_SAFE_CAST(deviceInfo, NSDictionary)) {
MTR_LOG_ERROR(" - Missing or malformed device Info");
}

NSNumber * nodeID = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationNodeIDKey], NSNumber);
if (!nodeID) {
MTR_LOG_ERROR(" - Missing or malformed nodeID");
Expand All @@ -541,7 +488,6 @@ - (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(N
}
}

// TODO: Create DeviceControllerRunningState that is a tri-state with "unknown", "not running", and "running" states
- (BOOL)isRunning
{
// For XPC controller, always return yes
Expand Down
27 changes: 0 additions & 27 deletions src/darwin/Framework/CHIP/MTRDevice_Concrete.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1074,15 +1074,6 @@ - (void)_updateEstimatedSubscriptionLatency:(NSNumber *)estimatedSubscriptionLat
_estimatedSubscriptionLatencyForDescription = estimatedSubscriptionLatency;
}

- (void)_updateEstimatedSubscriptionLatency:(NSNumber *)estimatedSubscriptionLatency
{
os_unfair_lock_assert_owner(&_lock);
_estimatedSubscriptionLatency = estimatedSubscriptionLatency;

std::lock_guard lock(_descriptionLock);
_estimatedSubscriptionLatencyForDescription = estimatedSubscriptionLatency;
}

// First Time Sync happens 2 minutes after reachability (this can be changed in the future)
#define MTR_DEVICE_TIME_UPDATE_INITIAL_WAIT_TIME_SEC (60 * 2)
- (void)_handleSubscriptionEstablished
Expand Down Expand Up @@ -1814,15 +1805,6 @@ - (void)_updateDeviceCachePrimed:(BOOL)deviceCachePrimed
_deviceCachePrimedForDescription = deviceCachePrimed;
}

- (void)_updateDeviceCachePrimed:(BOOL)deviceCachePrimed
{
os_unfair_lock_assert_owner(&_lock);
_deviceCachePrimed = deviceCachePrimed;

std::lock_guard lock(_descriptionLock);
_deviceCachePrimedForDescription = deviceCachePrimed;
}

- (void)_handleReportEnd
{
MTR_LOG("%@ handling report end", self);
Expand Down Expand Up @@ -2063,15 +2045,6 @@ - (void)_updateEstimatedStartTime:(NSDate *)estimatedStartTime
_estimatedStartTimeForDescription = _estimatedStartTime;
}

- (void)_updateEstimatedStartTime:(NSDate *)estimatedStartTime
{
os_unfair_lock_assert_owner(&_lock);
_estimatedStartTime = estimatedStartTime;

std::lock_guard lock(_descriptionLock);
_estimatedStartTimeForDescription = _estimatedStartTime;
}

- (void)_handleEventReport:(NSArray<NSDictionary<NSString *, id> *> *)eventReport
{
std::lock_guard lock(_lock);
Expand Down

0 comments on commit d7ca8f0

Please sign in to comment.