顯示具有 mac 標籤的文章。 顯示所有文章
顯示具有 mac 標籤的文章。 顯示所有文章

2014年12月3日 星期三

Core Bluetooth ios

keywork:
record,ios, xcode, object-c, central,peripheral ,GATT service and GATT client.
background:
if you need the basic knowledge you can reference previsour information that about the BLE (Bluetooth low energy 4.0 *1).
1. explain
First , every device have only one role (central or peripheral).;
central:
A central typically uses the information served up by peripherals to accomplish some particular task
work scan function and interaction with peripheral.
discovering,
Explore the data,
Send read and write requests
Subscribe to a characteristic’s value).
peripheral:
a peripheral typically has data that is needed by other devices.
which task has
Advertise your services ,
Respond to read and write requests from a connected central
Send updated characteristic values to subscribed centrals
image  
Secode , you should see the Bluetooth Core Special .about the GAP and GATT layer information.
I will map Core Bluetooth ios between Bluetooth Core Special. and the Bluetooth Core Special reference ……….
At BLE 4.0 ,every device only have one role (central or peripheral); which GAP role
about the GATT Service and Client(Bluetooth Core special) ,in which the Group data struct . the role (central and peripheral) can conatin GATT client/service . 
but in Core Bluetooth ios ,which not distruction GATT client/service.
the characteristic read/write properties setting is by client .
the central ,should be GATT client ;
another, peripheral is GATT sevice.
you can see next section about this;
image
2. Implement
A. Perpheral (GATT service)
how to
  • Start up a peripheral manager object
    • initWithDelegate:queue: method of the CBPeripheralManager class
    • image
    • peripheralManagerDidUpdateState: method of its delegate object
  • Set up services and characteristics on your local peripheral
    • image
    • Build Your Tree of Characteristics
    • image
    • Services
    • image
    • associate the characteristic with it by setting the service
    • image
    • THE properties and permissions,seeCBMutableCharacteristic Class Reference.
  • Publish your services and characteristics to your device’s local database
    • image
    • peripheralManager:didAddService:error: method of its delegate object.
    • image
  • Advertise your services
    • CBAdvertisementDataLocalNameKey and CBAdvertisementDataServiceUUIDsKey
    • image
    • When you start advertising some of the data on your local peripheral, the peripheral manager calls the
      peripheralManagerDidStartAdvertising:error: method of its delegate object
    • image
    • ** when you advertise the services 128 bit uuid ,which is not …
  • Respond to read and write requests from a connected central
    • receive a simple request to read the value of a characteristic
    • image
    • image
    • image
    • image
    •   central sends a request to write the value of one or more of your characteristics
    • image
    • image
    • ** if you have multi characteristics to read/write
    • 螢幕快照 2014-12-04 上午11.28.45
  • Send updated characteristic values to subscribed centrals
    • the subscribed characterstic is for enable the notify from central and stop adversting
    • image
    • updated value of the characteristic and send it to the central
    • image
    • Support Notifications
    • image
B.Central Role Tasks
how to:
  • Start up a central manager object
    • initWithDelegate:queue:
      method of the CBCentralManager class
    • image
    • When you create a central manager, the central manager calls the centralManagerDidUpdateState:
      method of its delegate object
  • Discover and connect to peripheral devices that are advertising
    • scanForPeripheralsWithServices:options: method of the CBCentralManager class
    • image
    • when a interest get
    • image
    • stop scan
    • image 
    • connectPeripheral:options: method of the
      CBCentralManager class
    • image
    • connection request is successful
    • image
    • image
  • Explore the data on a peripheral device after you’ve connected to it
    • you may discover that a peripheral has more services than
      what it advertises (in its advertising packets). You can discover all of the services that a peripheral offers by
      calling the discoverServices: method of the CBPeripheral class
    • image
    • specified services are discovered
    • image
    • Discovering the Characteristics of a Service
    • image
    • characteristics of the specified service are discovered.
    • image
  • Send read and write requests to a characteristic value of a peripheral’s service
    • image
    • delegate object to retrieve the
      value. If the value is successfully retrieved, you can access it through the characteristic’s value property
    • image
    •   write its value with some data (an
      instance of NSData) by calling the writeValue:forCharacteristic:type: method of the CBPeripheral
      class
    • image
    • The peripheral responds to write requests that are specified as CBCharacteristicWriteWithResponse by
      calling the peripheral:didWriteValueForCharacteristic:error: method of its delegate object
    • image
  • Subscribe to a characteristic’s value to be notified when it is updated
    • Though reading the value of a characteristic using the readValueForCharacteristic: method can be
      effective for some use cases, it is not the most efficient way to retrieve a value that changes.
    • image
    • image
p.s:
* BLE 4.0 ;
every device only have one role action. (central/peripheral); next BLE 4.1 which can work currently .

http://blog.csdn.net/jimoduwu/article/details/8917104







2014年11月2日 星期日

My vim @


XCode VIM(XVIM)







 

Eclipse(Vrapper)

 

Console Personal Vim 

(This is the personal Vim configuration of Danilo Dellaquila.)

 

 

 

reference:

cocoa vim

ViEmu

http://www.viemu.com/store.html

XVIM

https://github.com/XVimProject/XVim

Vi Input Manager

http://www.macupdate.com/app/mac/22864/vi-input-manager

Eclipse VIM

Vrapper

http://vrapper.sourceforge.net/home/

eclim

http://eclim.org/

Console Personal Vim

Danilo Dellaquila

https://github.com/ddellaquila/dd-vim

2014年10月10日 星期五

nRF51 @ Mac - overview











螢幕快照 2014-10-02 上午8.59.39 Fig 1. program tool(rknrfgo)

 螢幕快照 2014-10-02 下午5.54.23
Fig 2. Sniffer tools(nrf-ble-sniffer-osx)

 螢幕快照 2014-10-02 下午5.57.17
Fig 3. Wireshark ,need XQuartz
螢幕快照 2014-10-02 下午9.40.56
Fig 4.Spectum (iRF Explorer
螢幕快照 2014-10-02 上午9.37.46
Fig 6.IDE(Eclipse)nrf51osx
reference :

The J-Link hardware debugging Eclipse plug-in

http://gnuarmeclipse.livius.net/blog/jlink-debugging/
nRF51 tools
http://sourceforge.net/u/rolandking/profile/
iRF Explore
http://micro.arocholl.com/
wireshark
https://www.wireshark.org/download.html
XQuartz
http://xquartz.macosforge.org/landing/

2014年4月28日 星期一

How t setup a gnu tools on mac

為了將目前的開發環境,移值的mac上。 我想了一下大楖分為幾個部分,分別是:

1.editor and tools
            A.editor(vim + plugin)
            C.tmux
            B.debug tools(uart,minicom. LA tool.)

 2.compiler
            D. gun toolchain
            E. project manger(git or svn)
            F. debug (gdb)

3.start up for embedded system for my work ,on Nordic RF soc
           H. setup up on Eliscn
           I. base on gun tool
           J. how to do ..

----------------------------

先講一下,我目前的進度。 在第一部份,除了還沒將我之前MS的 gvim的設定搬過外,其它大致都有了。

而第2第分則將接下來用:今天來介紹的是how to setup up gun tool on Mac and other platform(windows'linux)

0. 首先,必須安裝好一些相關的套件(mpfr gmp libmpc libelf texinfo) 你可以直接使用 brew 來安裝。
brew install mpfr gmp libmpc libelf texinfo
*這邊我在安裝時,出現texinfo版本問題,但好像不影響最後結果。
 
1.安裝gun toolchain
  
原本也應用brew來進行,以便做套件管理。但我有試著用但沒找著。
homebrew chose not to include the ARM EABI toolchain in it’s offerings 

所以,改以下載並自行做編譯。
cd /opt 
git clone https://github.com/jsnyder/arm-eabi-toolchain
cd arm-eabi-toolchain
make install-cross
============這裡需較長時間,你必須確定好電源足夠才進行=======
在完成後,它會出現提示訊息請你將這個鏈結加入(~/.bash_profile)。
export PATH=/opt/arm-cs-tools/bin:$PATH











ref :
Setting Up an ARM EABI Toolchain on Mac OS X

2014年4月20日 星期日

Mac nrf51  二 -GDB

在上一個Mac nrf51 ,提到將過去所學習的用在這上面。
但不同的是,之前都是使用IDE 以及 沒有那個實體環境。最後使得我最後都沒有使用

GNU GDB
 這個是我之前所整理的內容,是關於GDB的使用。而現在我則要將它用於embeded system上。
 因為,這樣的系統稱為"遠端GDB"。
 即將裝置及開發環境分開,所以如下圖所示:
 fig 1: GDB subsystem,將在device上去執行gdb service。而由我們自己的PC上去進行連線的動作。

所以,我們將分成二部份。一為device的gdb server ;另一者為gdb client。 
在前面我們己將Segger(JLink)安裝好了,那接下來也是用它來做debug動作(同樣是不含S110)的。

而為了產生可除錯的資訊,所以需要在compiler中設定 -g -O0 . 見GCC使用。
並且產生一個可執行檔ELFExecutable and Linking Format),讓gdb載入。

Makefile:
# List all source files the application uses.
APPLICATION_SRCS = $(notdir $(wildcard ../*.c))
APPLICATION_SRCS += nrf_delay.c

PROJECT_NAME = $(shell basename "$(realpath ../)")

DEVICE = NRF51
BOARD = BOARD_NRF6310
SEGGER_SERIAL = 518001441

#USE_SOFTDEVICE = s110
SOFTDEVICE = $(HOME)/nrf51/tools/s110_nrf51822_6.0.0/s110_nrf51822_6.0.0_softdevice.hex
SDK_PATH = $(HOME)/nrf51/tools/nrf51_sdk_v5_2/nrf51822/
TEMPLATE_PATH = $(HOME)/nrf51/tools/nrf51_sdk_v5_2/nrf51822/template/

#CFLAGS = -Os
CFLAGS+= -DDEBUG -ggdb -O0

GDB_PORT_NUMBER = 2331

include $(TEMPLATE_PATH)Makefile

Makefile.posix 中

startdebug: debug-gdbinit
    #$(TERMINAL) "$(JLINKGDBSERVER) -port $(GDB_PORT_NUMBER)"
    $(JLINKGDBSERVER) -port $(GDB_PORT_NUMBER)
    sleep 1
    #$(TERMINAL) "$(GDB) $(ELF)"
    #$(GDB) $(ELF)

其執行如下:
A . 開啓 gdb server,



 
 






B. 在另一視窗中,開gdb client並進行連線。(需指定*.elf)













 連線(target remote...) ; load ; mon reset and break main
 使用continue執行。其它見segger JLink的說明help running(info)....

 




















https://devzone.nordicsemi.com/index.php/command-line-gdb-debugging-symbols-stack-trace