首页 \ 问答 \ 隐藏可连接的外围设备(Hide a connectable peripheral device)

隐藏可连接的外围设备(Hide a connectable peripheral device)

我打算编写蓝牙智能外围设备,但我不太清楚如何实现它。

外围设备只能连接到一个中央设备。 是否有可能在(一般可连接)广告(使用广告数据)期间告诉该外围设备不接受来自每个人的连接?

显然,在第一次连接之前,外围设备必须是“公共的”(对于任何中央设备是可见的和可连接的),但之后它只对与该中央设备的连接感兴趣。 这不是隐私或安全问题; 我只是试图不污染其他扫描中心设备的扫描结果。

我正在阅读Robin Heydon撰写的“Bluetooth Low Energy - 开发人员手册”一书,其中涵盖了一般蓝牙智能。 它提到了“Flags AD”广告数据。 这可能是我要找的吗? 这本书还提到了“粘合”,我理解这只是一种长期安全的关系。 我不需要加密链接,私人地址或签名写入,但它是否建议在我的情况下使用绑定?


I am going to program a Bluetooth Smart peripheral device, but I am not quite sure how to achieve it.

The peripheral shall only connect to one central device. Is it possible to tell during (general connectable) advertisement (using advertisement data) that this peripheral does not accept connections from everyone?

Obviously, the peripheral has to be "public" (visible and connectable for any central device) before its first connection, but after that it is only interested in connections to that central device. This is not a privacy or security concern; I just try to not pollute the scan results for other scanning central devices.

I am reading the book "Bluetooth Low Energy - the developers handbook" by Robin Heydon which covers general Bluetooth Smart. It mentions "Flags AD" advertisement data. Could this be what I am looking for? The book also mention "bonding" which I understand is just a long-term secure relationship. I don't need an encrypted link, private address or signed writes, but is it adviced to use bonding anyway in my case?


原文:https://stackoverflow.com/questions/34964757
更新时间:2022-05-19 10:05

最满意答案

我刚刚使用你的zip文件测试了你的应用程序。

我观察到的是,这不是放在#success div中的整个页面,而只是Posts/add.ctp视图的内容。 所以基本上这意味着RequestHandler正确地完成它的工作,这意味着使用的布局 'ajax'布局。 为了摆脱表单中的任何其他内容,add.ctp页面不应包含表单中的任何其他内容。 在您的情况下, Posts/add.ctp包含导航链接,这就是它们被复制的原因。

也就是说,提交按钮当前正在获取Posts/add.ctp视图的内容并将其插入空的#success div中。 但是你永远不会删除页面上已有的表单。 你可以做的是更新包含你的第一个表单的div的内容,甚至是整个Posts/add.ctp视图的内容。

在您的情况下,只需更新#content而不是#success div可能适合您的需求:

echo $this->Js->submit('Send', array(
  'before'=>$this->Js->get('#sending')->effect('fadeIn'),
  'success'=>$this->Js->get('#sending')->effect('fadeOut'),
  'update'=>'#content',
  'class'=>'btn btn-primary',
  'controller'=>'posts',
  'action'=>'add'
));

I just tested your application by using your zip file.

What I observed is that this is not the whole page that is put inside your #success div, but only the content of the Posts/add.ctp view. So basically this means the RequestHandler does its job correctly, meaning the layout that is used is the 'ajax' layout. To get rid of anything else that the form, the add.ctp page should not contain anything else that the form. In your case Posts/add.ctp contains navigation links, and that's why they get duplicated.

That said, what the submit button does currently is getting the content of Posts/add.ctp view and insert it in your empty #success div. But you never remove the form that was already on the page. What you could do is updating the content of a div that contains your first form, or even the content of the whole Posts/add.ctp view.

In your case, simply updating the #content instead of the #success div could maybe suit your needs:

echo $this->Js->submit('Send', array(
  'before'=>$this->Js->get('#sending')->effect('fadeIn'),
  'success'=>$this->Js->get('#sending')->effect('fadeOut'),
  'update'=>'#content',
  'class'=>'btn btn-primary',
  'controller'=>'posts',
  'action'=>'add'
));

相关问答

更多
  • 当我问另一个CakePHP人时,他告诉我使用JavaScript缓冲区并在CakeBook中链接到它: http ://book.cakephp.org/2.0/en/core-libraries/helpers/js.html 所以我的问题的答案是: 在请求的ajax操作的视图底部添加以下代码: echo $this->Js->writeBuffer(); // Write cached scripts When I asked another CakePHP guy, he told me to us ...
  • 我不确定这是否正确,但它对我有用。 AlbumsTable public function afterSave(Event $event, Entity $entity, ArrayObject $options) { if (isset($entity)) { $images = TableRegistry::get('Images'); $images->query() ->update() ->set(['forei ...
  • 这是如何使用蛋糕http://sandbox.dereuromark.de/sandbox/ajax_examples/chained_dropdowns实现链式选择的示例 - 该示例的相关文章位于http://www.dereuromark.de/2014/01/ 09 / AJAX和- cakephp中/ This is an example of how to implement chained selects with cake http://sandbox.dereuromark.de/sandb ...
  • 现在,似乎AJAX请求命中了“/ surveys / jobdetails”URL,但对结果没有任何作用。 您需要为AJAX请求添加回调,如下所示: $(document).ready(function() { $('#job_id').change(function() { $.post('/surveys/jobdetails', {id: $(this).attr('id')}, function(result) { $('#job_id ...
  • 你必须使用ajax布局。 $this->layout = ($this->request->is("ajax")) ? "ajax" : "default"; 您还可以将此代码段放在AppController中,以用于应用程序范围内的Ajax响应。 public function beforeRender() { $this->layout = ($this->request->is("ajax")) ? "ajax" : "default"; } you have to use an ajax ...
  • 我刚刚使用你的zip文件测试了你的应用程序。 我观察到的是,这不是放在#success div中的整个页面,而只是Posts/add.ctp视图的内容。 所以基本上这意味着RequestHandler正确地完成它的工作,这意味着使用的布局是 'ajax'布局。 为了摆脱表单中的任何其他内容,add.ctp页面不应包含表单中的任何其他内容。 在您的情况下, Posts/add.ctp包含导航链接,这就是它们被复制的原因。 也就是说,提交按钮当前正在获取Posts/add.ctp视图的内容并将其插入空的#suc ...
  • 我发现所有这一切都是因为css错误而发生的,当我设置map-canvas div的高度显示的地图时。 map-canvas和其他元素的css代码是: #map_canvas label{width:auto; display:inline; height: 900px; /*Your height here*/} #map_canvas img{max-width:none} .gmaps label{width:auto; display:inl ...
  • 以下是步骤: 您的搜索方法将数据作为JSON返回 。 然后在你的页面循环数据在jquery模板中 。 这是一个如何使用jQuery模板的例子 ,这里是它的文档 这是另一种方法 UPDATE 简单的返回json结果来自您的搜索方法: public function searchData(){ $this -> layout = 'ajax'; $this -> autoRender = false; if($this->request->is('post')){ if(!empty($data)){ ...
  • 您的表单的操作URL应该是/btstadmin/pages/ajax_edit/3.json而不是/btstadmin/pages/ajax_edit.json/3 。 url扩展名应始终位于url的末尾。 Your form's action url should be /btstadmin/pages/ajax_edit/3.json instead of /btstadmin/pages/ajax_edit.json/3. The url extension should always be at t ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)