eturn cmdRes ; The viWrite() operation synchronously transfers data. The data to be written are in the buffer represented by variable "buf." This operation returns only when the transfer terminates. If the writing of the command on the instrument was successful, we will attempt to read the result of this command from the instrument. For this purpose, we use the viRead() function. unsigned char buffer [100] ; ViUInt32 retCount; status = viRead (instr, buffer, 100, &retCount) i The parameters required by the viRead function are given in Figure 12.45. The viRead() operation synchronously transfers data. The data read are to be stored in the buffer represented by variable "buf." This operation returns only when the transfer terminates. Service Delivery Platforms Direction Description Unique logical identifier to a session. Location of a buffer to receive data from device. count Number of bytes to be read. retCount Number of bytes actually transferred. Figure 12.45 Parameters of viRead() function. If the read operation was successful, we copy the value from the buffer and set it on the object that will be returned by the service operation: cmdRes - > executionStatus = "OK" ; cmdRes - > result = new char [512] ; sprintf (cmdRes - > result, "%*S" , retCount, buffer) ; 3. GetInstrumentStatus operation: GetInstrumentStatus operation returns the status of an instrument. This operation takes as parameter the visa instrument address and returns the value of the status bit obtained from the instrument. The instrument descriptor must have one of the formats described above in the getInstrumentList operation. Usually the instrument address (or descriptor) is obtained by invoking the getInstrumentList operation (opening the default resource manager, as shown before). Based on the instrumenti Descriptor parameter which contains the instrument address descriptor, we try to open a communication session with the instrument located at that address. This is done using the viOpen() function. status = viOpen (defaultRM, instrumentDescri