blob: 45e67adf3d476743aa303f48b6e1399d9cbe78e7 [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package human_motion_robot
import (
// Call calls XMLRPC on touchhost.
func Call(ctx context.Context, in tlw.Access, host *tlw.HumanMotionRobot, method string) (*xmlrpc.Value, error) {
if method == "" {
return nil, errors.Reason("HMR TouchHost call: method name is empty").Err()
res := in.CallTouchHostd(ctx, &tlw.CallTouchHostdRequest{
Resource: host.GetTouchhost(),
Method: method,
log.Debugf(ctx, "HMR TouchHost call %q with hostname %q: received %q", method, host.GetTouchhost(), res.GetValue().GetString_())
if res.GetFault() {
return nil, errors.Reason("unable to make HMR TouchHost call %q with hostname %q: %q", method, host.GetTouchhost(), res.GetValue().GetString_()).Err()
return res.GetValue(), nil