我是nativescript的新手。对不起,我的英语不好。 希望你们能帮助我。
我有一个带有angular 2应用程序的本机脚本。我目前正在做蓝牙信标。我想为我的应用程序提供摄像头功能,每次按下该按钮,信标就会通知。当按钮被按下时,我想要的是什么。相机将拍摄照片,而不是用户手册。单击相机按钮。
这是我的代码。
public static async Task RunTask() {
StdSchedulerFactory factory = new StdSchedulerFactory(System.Configuration.ConfigurationManager.AppSettings);
IScheduler scheduler = await factory.GetScheduler();
await scheduler.Start();
IReadOnlyCollection<string> jgn = await sch.GetJobGroupNames(new System.Threading.CancellationToken());
foreach (string jno in jgn)
{
IReadOnlyCollection <JobKey> jk = await sch.GetJobKeys(jobGroupEquals(jno));
foreach (JobKey j in jk)
{
var currentJob = await sch.GetJobDetail(j);
//print the properties of the current job
Console.WriteLine(currentJob.Key.Name);
Console.WriteLine(currentJob.Description);
}
}
}
private static GroupMatcher<JobKey> jobGroupEquals(string jno)
{
return GroupMatcher<JobKey>.GroupEquals(jno);
}
bluetooth.startNotifying({
peripheralUUID: "FF:FF:90:01:B1:EF",
serviceUUID: "ffe0",
characteristicUUID: "ffe1",
onNotify: function (result) {
try {
var data = new Uint8Array(result.value);
console.log('notify: ' + JSON.stringify(data[0]));
/* camera.takePicture()*/
if (data[0] = 1) {
camera.takePicture()
.then(function (imageAsset) {
console.log("Result is an image asset instance");
var image = new imageModule.Image();
image.src = imageAsset;
}).catch(function (err) {
console.log("Error -> " + err.message);
});
}
}
catch (e) {
alert('notify value not readable: ' + e.message);
}
}
}).then(function () {
console.log("subscribed for notifications");
});