04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Section 8. Operation<br />

Scan(1,Sec,0,0)<br />

'In the case of the <strong>CR1000</strong> being the ModBus master then the<br />

'ModbusMaster instruction would be used (instead of fixing<br />

'the variables as shown between the BeginProg and SCAN instructions).<br />

ModbusMaster(Result,COMRS232,-115200,5,3,Register(),-1,2,3,100)<br />

'MoveBytes(DestVariable,DestOffset,SourceVariable,SourceOffSet,<br />

'NumberOfBytes)<br />

MoveBytes(Combo,2, Register_LSW,2,2)<br />

MoveBytes(Combo,0, Register_MSW,2,2)<br />

NextScan<br />

EndProg<br />

8.6.3 Web Service API<br />

The <strong>CR1000</strong> Web API (Application Programming Interface) is a series of URL (p.<br />

470) commands that manage <strong>CR1000</strong> resources. The API facilitates the following<br />

functions:<br />

• Data Management<br />

o Collect data<br />

• Control<br />

o Set variables / flags / ports<br />

• Clock Functions<br />

o Set <strong>CR1000</strong> clock<br />

• File Management<br />

o Send programs<br />

o Send files<br />

o Collect files<br />

The full command set is available in the most recent <strong>CR1000</strong> operating system<br />

(see operating system in the glossary). API commands are also used with<br />

<strong>Campbell</strong> <strong>Scientific</strong>’s RTMC web server datalogger support software (p. 77). The<br />

following documentation focuses on API use with the <strong>CR1000</strong>. A full discussion<br />

of use of the API commands with RTMC is available in CRBasic Editor Help,<br />

which is one of several programs available for PC to <strong>CR1000</strong> support (p. 77).<br />

8.6.3.1 Authentication<br />

The <strong>CR1000</strong> passcode security scheme described in the Security (p. 70) section is<br />

not considered sufficiently robust for API use because,<br />

1. the security code is plainly visible in the URI, so it can be compromised by<br />

eavesdropping or viewing the monitor.<br />

2. the range of valid security codes is 1 to 65534, so the security code can be<br />

compromised by brute force attacks.<br />

Instead, Basic Access Authentication, which is implemented in the API, should be<br />

used with the <strong>CR1000</strong>. Basic Access Authentication uses an encrypted user<br />

account file, .csipasswd, which is placed on the CPU: drive of the <strong>CR1000</strong>.<br />

372

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!