You are on page 1of 4

- Nhng Web protocol ngy nay khng th p ng nhng rng buc ca WSNs (lowpower,

lossly, kch thc gi tin nh, b nh gii hn, multihop network, bng thng nhb sung) dn
n s ra i ca mt giao thc mi p ng nhng rng bun trn: CoAP.
- Constrained Application Protocol (CoAP) l mt giao thc tng ng dng c thit k cung
cp giao din ging nh REST, nhng vi tiu tn hn v bng thng v n gin hn vic trin
khai so vi giao din REST da trn HTTP.
- Ging nh HTTP, CoAP cng bao gm cc khi nim nh resource, URIs, kin trc REST nhng s
dng mt dng gi tin thu gn v c th phn tch d dng.
- Khng ging nh HTTP qua TCP, CoAP s dng UDP. iu ny gip bn c th s dng CoAP
trong cc m hnh truyn thng one-to-many v many-to-one.
- y l mt dng web transfer protocol (a RESTful protocol RESTful protocol ?) c bit c th
ng dng cho cc h thng:
M2M applications (smart energy, building automation,etc)
Monitor simple sensors (temperature sensors, light switches,etc).
Control actuators (light switches, heating controllers, door clocks)
Manage devices.
- CoAP cung cp m hnh tng tc yu cu / phn hi gia cc thit b u cui lp ng dng, h
tr pht hin dch v tch hp sn v resource v bao gm cc khi nim chnh ca Web nh
URIs v Internet media types. CoAP c thit k d dng giao tip vi HTTP tham gia vo
mi trng web trong khi p ng yu cu chuyn mn chng hn nh h tr multicast, kch
thc gi tin nh, v n gin cho mi trng hn ch.
- S dng giao thc UDP ng tin cy v h tr multicast.
- GET, POST, PUT, DELETE methos
- H tr Uniform Resource Identifier (URI).
- Kch thc nh, header n gin < 10 bytes
- ng dng cho phng thc truyn ng b v bt ng b.
- Easy to proxy to/from HTTP.
- Tuy nhin: CoAP khng phi l s thay th ca HTTP, ta xem y l dng thu gn ca HTTP
(slide 66).Coap s dng trong mng cm bin khng dy ( . )
Nhng yu cu ca CoAP

- C ch ca b my CoAP:

1) Cc ng dng c th gi cc tin nhn CoAP tin cy ("confirmable") hoc khng ng tin


cy ("nonconfialable"). Cc i s c truyn li vi thi gian ch cho n khi c
nhn bi ngi nhn hoc t n s ln pht li ti a.
2) CoAP nhm cung cp truyn thng nhm thng qua IP multicast nhng c ch ny vn
cha c c th ha.
3) CoAP c cc thng bo y bn a thng qua c ch publish/subscribe c gi l "quan
st ti nguyn". Client c th gi mt yu cu vi mt tiu ty chn quan st n mt
ngun ti nguyn CoAP. Server theo di nhng ngi ng k ny v gi phn hi bt c
khi no ti nguyn quan st c thay i.
4) i vi vic pht hin ti nguyn, CoAP theo RFC 5785 bng cch s dng ng dn
/.well-known/core cung cp cc m t ti nguyn trong CoRE Link Format. nh dng
ny m rng Web Linking v xc nh cc thuc tnh cho mt loi ng ngha ("rt"), cch s
dng giao din ("if"), loi ni dung ("ct"), v kch thc mong i ti a ("sz") ca ti
nguyn. Ngoi ra, mt dch v th mc dc d nh.
- Khi b nh RAM cho IP v b m ng dng b hn ch, thit b ch c th x l mt s lng
d liu c th trong mt thi gian. D liu ln hn c th c x l bng cch lu tr cc
"khi" ny trong b nh fl ash, v d nh nhn c mt phn mm rmware mi hoc
cung cp mt datalog y . trnh s cn thit ca mt giao thc th cp trao i
nhng d liu ny, CoAP ch nh mt c ch ngng v ch n gin gi l "php chuyn
khi"
A. The Contiki REST Engine
- L mt s ci thin ca Contikis REST layer
- N cung cp cc macro xc nh v t ng khi to ngun ti nguyn RESTful Web.
- Cng c REST mi cung cp ba khi nim tru tng to cc ngun RESTful:
RESOURCE: i vi mi ti nguyn, ng dng phi cung cp mt hm x l ti nguyn
nhn c yu cu v to ra phn hi tng ng. C nhng message c truy cp
thng qua REST Engine API
EVENT_RESOURCE: Yu cu mt hm iu khin th hai c thc hin bi nh pht
trin ng dng.
PERIODIC_RESOURCE: REST Engine nh k gi mt chc nng iu khin th hai
tng t vi mt cho cc s kin. Chc nng ny c th c s dng thm d cc
cm bin on-board v v d thc hin kim tra ngng cho d ti nguyn c nn c
xem l thay i hay khng.

- Cui cng, mt ng dng dch v RESTful Web in hnh bao gm mt C-fi duy nht. N cha
cc macro ti nguyn cng vi cc chc nng x l ca chng v mt quy trnh Contiki khi
to REST Engine, kch hot cc ti nguyn v ty chn ch i cho cc s kin ca ngi dng
cho bt k EVENT_RESOURCE no.

B. Blockwise Transfers

- CoAP thc hin h tr truyn cc Blockwise


- Nu mt phn hi c to ra bi mt trnh x l ti nguyn vt qu kch thc khi yu
cu ca khch hng, th REST Engine s t ng chia cu tr li m khng cn s tham gia ca
trnh x l.
C. Separate Responses

- Mt vi ngun ti nguyn c th yu cu x l thi gian di hoc i ti nguyn t phn cng


nh mt cm bin chm, trong mt khong thi gian khng xc nh.
- iu ny l khng cn thit cho s truyn li hoc tr li li timeout
- V vy, CoAP cung cp phn hi ring bit, cho php my ch gi ACK trng ngay lp tc v
mt thng bo c th b xa khi hon thnh.
EVALUATION trong bi vit ca Thi