mkoppanen / libVISCA2

Fork of http://damien.douxchamps.net/libvisca/
GNU Lesser General Public License v2.1
28 stars 33 forks source link

Support for VISCA over TCP/UDP #3

Open eclazi opened 7 years ago

eclazi commented 7 years ago

Some devices allow control via TCP or UDP using the VISCA packet format.

joshirupesh1987 commented 7 years ago

Dear Hi I am using PIC MICROCONTROLLER

In this function I can't understand WriteFile function,because of this function your code in not working in my compiler.

uint32_t _VISCA_write_packet_data(VISCAInterface_t iface, VISCACamera_t camera, VISCAPacket_t packet) { DWORD iBytesWritten;

WriteFile(iface->port_fd, packet->bytes, packet->length, &iBytesWritten, NULL); if ( iBytesWritten < packet->length ) return VISCA_FAILURE; else return VISCA_SUCCESS; } 2nd doubt In this function I can't understand ReadFile *function,because of this function your code in not working in my compiler.

uint32_t _VISCA_get_packet(VISCAInterface_t *iface) { int pos=0; BOOL rc; DWORD iBytesRead;

// wait for message rc=ReadFile(iface->port_fd, iface->ibuf, 1, &iBytesRead, NULL); if ( !rc || iBytesRead==0 ) { // Obtain the error code //m_lLastError = ::GetLastError(); _RPTF0(_CRT_WARN,"ReadFile failed.\n"); return VISCA_FAILURE; } while (iface->ibuf[pos]!=VISCA_TERMINATOR) { if ( ++pos >= VISCA_INPUT_BUFFER_SIZE ) { // Obtain the error code //m_lLastError = ::GetLastError(); _RPTF0(_CRT_WARN,"illegal reply packet.\n"); return VISCA_FAILURE; } rc=ReadFile(iface->port_fd, iface->ibuf + pos, 1, &iBytesRead, NULL); if ( !rc || iBytesRead==0 ) { // Obtain the error code //m_lLastError = ::GetLastError(); _RPTF0(_CRT_WARN,"ReadFile failed.\n"); return VISCA_FAILURE; } } iface->bytes=pos+1;

return VISCA_SUCCESS; } rest of thing are understandable

Please give response on my email id joshirupesh1989@gmail.com

Thanks