• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HarmonyClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.whistlingfish.harmony.HarmonyClient的典型用法代码示例。如果您正苦于以下问题:Java HarmonyClient类的具体用法?Java HarmonyClient怎么用?Java HarmonyClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HarmonyClient类属于net.whistlingfish.harmony包,在下文中一共展示了HarmonyClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: connectClient

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Connects a client and adds to our map
 * @param qualifier
 * @param hostConfig
 */
private void connectClient(String qualifier, HostConfig hostConfig){
	try {
		HarmonyClient harmonyClient = HarmonyClient.getInstance();
		logger.debug("Connecting {} to {} with user {}", qualifier, hostConfig.getHost(), hostConfig.getUsername() );
		harmonyClient.connect(hostConfig.getHost(), hostConfig.getUsername(),
				hostConfig.getPassword());
		hubs.put(qualifier, new HarmonyHubInstance(harmonyClient));
		logger.debug("Devices for qualifier {}\n{}",qualifier,harmonyClient.getDeviceLabels().toString());
		logger.debug("Activity for qualifier {}\n{}",qualifier,harmonyClient.getConfig().getActivities());
		logger.debug("Config for qualifier {}\n{}", qualifier,harmonyClient.getConfig().toJson());
	} catch (Exception e) {
		logger.error(format(//
				"Failed creating harmony hub connection to %s", hostConfig.getHost()), e);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:21,代码来源:HarmonyHubGateway.java


示例2: pressButton

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Simulates pressing a button on a harmony remote
 * @param qualifier
 * @param device
 * @param button
 */
public void pressButton(String qualifier, final String device, final String button) {
	logger.debug("pressButton for qualifer {} device {} and button {}", qualifier, device, button);

	if (!properlyConfigured) {
		throw new IllegalStateException(
				"Harmony Hub Gateway is not properly configured, or the connection is not yet started");
	}
	withClient(checkQualifier(qualifier), new ClientRunnable() {
		@Override
		public void run(HarmonyClient client) {
			try {
				client.pressButton(Integer.parseInt(device), button);
			} catch (NumberFormatException e) {
				client.pressButton(device, button);
			}
		}
	});
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:25,代码来源:HarmonyHubGateway.java


示例3: startActivity

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Starts a Harmony Hub activity
 * @param qualifier
 * @param activity
 */
public void startActivity(String qualifier, final String activity) {
	logger.debug("startActivity for qualifer {} and activity {}", qualifier, activity);
	if (!properlyConfigured) {
		throw new IllegalStateException(
				"Harmony Hub Gateway is not properly configured, or the connection is not yet started");
	}
	withClient(checkQualifier(qualifier), new ClientRunnable() {
		@Override
		public void run(HarmonyClient client) {
			try {
				client.startActivity(Integer.parseInt(activity));
			} catch (NumberFormatException e) {
				client.startActivityByName(activity);
			}
		}
	});
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:23,代码来源:HarmonyHubGateway.java


示例4: pressButton

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public void pressButton(String qualifier, final String device, final String button) {
    if (!properlyConfigured) {
        throw new IllegalStateException(
                "Harmony Hub Gateway is not properly configured, or the connection is not yet started");
    }
    withClient(qualifier, new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            try {
                client.pressButton(Integer.parseInt(device), button);
            } catch (NumberFormatException e) {
                client.pressButton(device, button);
            }
        }
    });
}
 
开发者ID:tuck182,项目名称:openhab-harmony-binding,代码行数:17,代码来源:HarmonyHubGateway.java


示例5: startActivity

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public void startActivity(String qualifier, final String activity) {
    if (!properlyConfigured) {
        throw new IllegalStateException(
                "Harmony Hub Gateway is not properly configured, or the connection is not yet started");
    }
    withClient(qualifier, new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            try {
                client.startActivity(Integer.parseInt(activity));
            } catch (NumberFormatException e) {
                client.startActivityByName(activity);
            }
        }
    });
}
 
开发者ID:tuck182,项目名称:openhab-harmony-binding,代码行数:17,代码来源:HarmonyHubGateway.java


示例6: connectClient

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Connects a client and adds to our map
 *
 * @param qualifier
 * @param hostConfig
 */
private synchronized void connectClient(String qualifier, HostConfig hostConfig) {
    try {
        if (hubs.containsKey(qualifier)) {
            HarmonyHubInstance instance = hubs.get(qualifier);
            instance.client.disconnect();
            hubs.remove(qualifier);
        }
        HarmonyClient harmonyClient = HarmonyClient.getInstance();
        logger.debug("Connecting {} to {} with user {}", qualifier, hostConfig.getHost(), hostConfig.getUsername());
        harmonyClient.connect(hostConfig.getHost(), hostConfig.getUsername(), hostConfig.getPassword());
        hubs.put(qualifier, new HarmonyHubInstance(harmonyClient));
        logger.debug("Devices for qualifier {}\n{}", qualifier, harmonyClient.getDeviceLabels().toString());
        logger.debug("Activity for qualifier {}\n{}", qualifier, harmonyClient.getConfig().getActivities());
        logger.debug("Config for qualifier {}\n{}", qualifier, harmonyClient.getConfig().toJson());
    } catch (Exception e) {
        logger.error(format(//
                "Failed creating harmony hub connection to %s", hostConfig.getHost()), e);
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:26,代码来源:HarmonyHubGateway.java


示例7: pressButton

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Simulates pressing a button on a harmony remote
 *
 * @param qualifier
 * @param device
 * @param button
 */
public void pressButton(String qualifier, final String device, final String button) {
    logger.debug("pressButton for qualifer {} device {} and button {}", qualifier, device, button);

    if (!properlyConfigured) {
        throw new IllegalStateException(
                "Harmony Hub Gateway is not properly configured, or the connection is not yet started");
    }
    withClient(checkQualifier(qualifier), new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            try {
                client.pressButton(Integer.parseInt(device), button);
            } catch (NumberFormatException e) {
                client.pressButton(device, button);
            }
        }
    });
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:26,代码来源:HarmonyHubGateway.java


示例8: startActivity

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Starts a Harmony Hub activity
 *
 * @param qualifier
 * @param activity
 */
public void startActivity(String qualifier, final String activity) {
    logger.debug("startActivity for qualifer {} and activity {}", qualifier, activity);
    if (!properlyConfigured) {
        throw new IllegalStateException(
                "Harmony Hub Gateway is not properly configured, or the connection is not yet started");
    }
    withClient(checkQualifier(qualifier), new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            try {
                client.startActivity(Integer.parseInt(activity));
            } catch (NumberFormatException e) {
                client.startActivityByName(activity);
            }
        }
    });
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:24,代码来源:HarmonyHubGateway.java


示例9: HarmonyRest

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public HarmonyRest(HarmonyClient theClient, Boolean noopCallsSetting, int sleepMillis, DevModeResponse devResponseSetting) {
	super();
	noopCalls = noopCallsSetting;
	devMode = Boolean.TRUE;
	devResponse = null;
	if(devResponseSetting == null)
		devMode = Boolean.FALSE;
	else
		devResponse = devResponseSetting;
	sleepTime = sleepMillis;
	harmonyClient = theClient;
}
 
开发者ID:bwssytems,项目名称:restful-harmony,代码行数:13,代码来源:HarmonyRest.java


示例10: HarmonyHandler

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public HarmonyHandler(HarmonyClient theClient, Boolean noopCallsSetting, DevModeResponse devResponseSetting) {
	super();
	noopCalls = noopCallsSetting;
	devMode = Boolean.TRUE;
	devResponse = null;
	if(devResponseSetting == null)
		devMode = Boolean.FALSE;
	else
		devResponse = devResponseSetting;
	harmonyClient = theClient;
}
 
开发者ID:bwssytems,项目名称:ha-bridge,代码行数:12,代码来源:HarmonyHandler.java


示例11: removeAllClients

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Remove all clients and clear our map
 */
private synchronized void removeAllClients() {
	for(String qualifier : hubs.keySet()) {
		HarmonyClient c = hubs.get(qualifier).getClient();
		c.disconnect();
	}
	hubs.clear();
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:HarmonyHubGateway.java


示例12: addListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Adds a {@link HarmonyHubListener} to a {@link HarmonyClient}
 * @param qualifier
 * @param listener
 */
public void addListener(String qualifier, final HarmonyHubListener listener) {
	withClient(checkQualifier(qualifier), new ClientRunnable() {
		@Override
		public void run(HarmonyClient client) {
			client.addListener(listener);
		}
	});
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:HarmonyHubGateway.java


示例13: removeListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Removes a {@link HarmonyHubListener} from a {@link HarmonyClient}
 * @param qualifier
 * @param listener
 */
public void removeListener(String qualifier, final HarmonyHubListener listener) {
	withClient(checkQualifier(qualifier), new ClientRunnable() {
		@Override
		public void run(HarmonyClient client) {
			client.removeListener(listener);
		}
	});
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:14,代码来源:HarmonyHubGateway.java


示例14: withClient

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
private void withClient(String qualifier, ClientRunnable runnable) {
    HarmonyClient client = clients.get(qualifier);
    if (client == null) {
        throw new IllegalArgumentException(format("No client '%s' defined", qualifier));
    }
    runnable.run(client);
}
 
开发者ID:tuck182,项目名称:openhab-harmony-binding,代码行数:8,代码来源:HarmonyHubGateway.java


示例15: addListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public void addListener(String qualifier, final HarmonyHubListener listener) {
    withClient(qualifier, new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            client.addListener(listener);
        }
    });
}
 
开发者ID:tuck182,项目名称:openhab-harmony-binding,代码行数:9,代码来源:HarmonyHubGateway.java


示例16: removeListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
public void removeListener(String qualifier, final HarmonyHubListener listener) {
    withClient(qualifier, new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            client.removeListener(listener);
        }
    });
}
 
开发者ID:tuck182,项目名称:openhab-harmony-binding,代码行数:9,代码来源:HarmonyHubGateway.java


示例17: removeAllClients

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Remove all clients and clear our map
 */
private synchronized void removeAllClients() {
    for (String qualifier : hubs.keySet()) {
        HarmonyClient c = hubs.get(qualifier).getClient();
        c.disconnect();
    }
    hubs.clear();
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:11,代码来源:HarmonyHubGateway.java


示例18: addListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Adds a {@link HarmonyHubListener} to a {@link HarmonyClient}
 *
 * @param qualifier
 * @param listener
 */
public void addListener(String qualifier, final HarmonyHubListener listener) {
    withClient(checkQualifier(qualifier), new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            client.addListener(listener);
        }
    });
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:15,代码来源:HarmonyHubGateway.java


示例19: removeListener

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Removes a {@link HarmonyHubListener} from a {@link HarmonyClient}
 *
 * @param qualifier
 * @param listener
 */
public void removeListener(String qualifier, final HarmonyHubListener listener) {
    withClient(checkQualifier(qualifier), new ClientRunnable() {
        @Override
        public void run(HarmonyClient client) {
            client.removeListener(listener);
        }
    });
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:15,代码来源:HarmonyHubGateway.java


示例20: HarmonyHubInstance

import net.whistlingfish.harmony.HarmonyClient; //导入依赖的package包/类
/**
 * Creates a new HarmonyHubInstance from a given client
 * @param client
 */
public HarmonyHubInstance(HarmonyClient client) {
	super();
	this.client = client;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:9,代码来源:HarmonyHubGateway.java



注:本文中的net.whistlingfish.harmony.HarmonyClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MappedFileDataInput类代码示例发布时间:2022-05-22
下一篇:
Java Query类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap