Version 1 (modified by 15 years ago) ( diff ) | ,
---|
Standard 825 Library (lib825)
Table of Contents
- Application Libraries
- Database Libraries
- Standard 825 Library (lib825)
- Standard 825 Library with EVENT features (lib825ev)
- Communications Functions
- CComm
- CCommClient
- CCommSerial
- CCommServer
- Analog Output (DAC Digital to Analog Conversion) Functions
- GetDAC
- GetDACPercent
- GetDACRangeFromIndex
- GetIndexFromDACRange
- SetDACFloat
- SetDACOutputRange
- SetDACPercent
- SetDACReg
- SetDACTrackGrossNet
- SetDACTrackScale
- StopDACTrackScale
- Debug Functions
- DEBUG_MSG
- DEBUG_SHOWDATA
- Display Functions
- CBitmap
- CFont 825gen2
- CImage 825gen2
- ClearLCD
- DisplayStr DEPRECATED - Replace with DisplayText
- DisplayText
- GetX
- GetY
- InitLCD
- IsFontLoaded
- LocateLCD
- PrintLCD
- PrintLCDbutton
- PrintLCDfont2
- ReadFont
- SetBkColor
- SetCurColor
- File Functions
- CFile
- FileCopy
- FindChromiumPath 825gen2
- FindFlashDrive 825gen2
- GetFilesInPathWithExtension
- IsMounted
- MakeDirIfNotExists
- MountDirectory 825gen2
- UnmountDirectory 825gen2
- Form Functions
- CForm
- CFormRect 825gen2
- EVENT
- EVENT_FLAG_SHOW
- EVENT_SHOW_BTN_CONTENT
- EnableItem
- ExitWithCode
- FORM_ADD_BUTTON
- FORM_ADD_BUTTON2 825gen2
- FORM_ADD_INPUT
- FORM_ADD_INPUT2 825gen2
- FORM_DONE_ESCAPE
- FORM_DONE_EVENT_EXTERNAL
- FORM_DONE_LEFT_ARROW
- FORM_HIDE
- FORM_INIT
- FORM_IS_UPDATED
- FORM_RUN
- FORM_SHOW
- FindName
- GetCurrentItemIndex
- GetExitCode
- GetItem
- !GetItemByIDVal
- GetItemCount
- GetItemIndex
- HideItem
- IN_EVENT_HIDE_FORM
- IN_EVENT_SHOW_FORM
- IN_EVENT_WRITE_DATA
- IsChanged
- SetInputFont
- SetKeyEvent
- ShowItem
- WriteData
- Input / Output (Digital I/O) Functions
- GetInput
- GetInputMask
- GetOutput
- SetDIOCounter
- SetOutput
- SetOutputMask
- StartDIOPulse
- StartRepeatIO Deprecated
- StopDIOPulse
- StopRepeatIO Deprecated
- Keypad/Sound Functions
- ClearKeyBuffer
- KeyPadInsertKey
- KeyPadSetUSBEvent
- OpenBeeper
- PlayNotes
- WaitKeypress
- Process Functions
- GetProcessID
- GetProcessIDExcludeSelf
- KillProcess
- ResetPrevGrossWt
- ResetPrevNetWt
- ResetPrevTareWt
- test
- String Functions
- FloatToStr
- IntToStr
- StrFmt
- StrFmtLen
- StrToFloat
- StrToInt
- StrTrimLeft
- StrTrimRight
- Ticket Functions
- CTktFlds
- PrintTkt
- Time and Date Functions
- CMillisecondTimer
- CSleep
- CTimer
- DoSleep
- GetDateStr
- GetLinuxTime
- GetTimeStr
- IsTimeChanged
- ResetPrevTime
- SleepMilliseconds
- SleepSeconds
- Utility Functions
- GetKernelVer
- GetKernelVerStr
- GetLoaderVer
- GetLoaderVerStr
- GetMemFree
- GetMnBdVer
- GetMnBdVerStr
- Weighing Functions
- CheckWIM * DEPRECATED - New apps should use MnBdSetWIM *
- DLCRepeatMultiIncludeCellWts
- FormatGrossWt
- FormatNetWt
- FormatTareWt
- FormatWt
- GetBelowZero
- GetCapacity
- GetCenterZero
- GetCurUnitsLabel
- GetDecimal
- GetGrossWt
- GetInterval
- GetMotion
- GetNetWt
- GetNumScales
- GetOverCap
- GetProcessScale
- GetSecUnitsLabel
- GetTareWt
- GetUnitsLabel
- GetWtError
- IsGrossWtChanged
- IsNetWtChanged
- IsTareWtChanged
- IsWtStatusChanged
- IsWtUnitsChanged
- MnBdClearEvent
- MnBdClose
- MnBdGetErr
- MnBdGetErrMsg
- MnBdGetErrMsgStr
- MnBdOpen
- MnBdProcess * DEPRECATED - New apps should use StartRepeatMulti *
- MnBdRead
- MnBdRequest
- MnBdSetEvent
- MnBdSetWIM
- MnBdShutdown
- MnBdStartup
- RequestWt * DEPRECATED - New apps should use StartRepeatMulti *
- ResetPrevGrossWt
- ResetPrevNetWt
- ResetPrevTareWt
- ResetPrevWtStatus
- ResetPrevWtUnits
- SetTareCurrent
- SetTareValue
- SetWIM * DEPRECATED - New apps should use MnBdSetWIM *
- StartRepeatMulti
- StartRepeatWt * DEPRECATED - New apps should use StartRepeatMulti *
- StopRepeatMulti
- StopRepeatWt * DEPRECATED - New apps should use StopRepeatMulti *
- ZeroScale
- Development Environment
- Application Signing
- Debugging
- Setup for Software Development
- Version Control
- Device Support
- Device Drivers
- Beeper
- DIO
- Display
- Network
- Serial Ports
- USB Support
- Weighing
- Foundation
- Application Mode Startup
- Shell operations - Linux / Windows command line Reference
Utility Functions
Some simple routines may be used in the apps to convert between the hexadecimal strings and the various structures.
These routines are packaged in [doxygen:hexutil_8cpp-source.html hexutil.cpp]
For example, an app may access time/date from the mainboard with the following:
char* mnbd_dev "/dev/mnbd"; int g_fileMnBd = 0; int OpenMnBd(void) { /* O_NONBLOCK allows open even with no carrier detect */ g_fileMnBd = open(mnbd_dev, O_RDWR | O_NOCTTY | O_NONBLOCK); if(g_fileMnBd == -1) { printf("Error opening %s\n", mnbd_dev); return -1; } return 0; } void CloseMnBd(0) { close(g_fileMnBd); return; } int z; char readbuf![50]; char rcvbuf![50]; int rcvbufpos = 0; int nread; OpenMnBd(); write(g_fileMnBd, "S\r", 2); // Request date/time from mainboard // In main loop of application: for(;;) { nread = read(g_fileMnBd, &readbuf, sizeof(readbuf) ); if(nread > 0) { for(z = 0; z < nread; z++) { if(readbuf[z] == '\r') { rcvbuf[rcvbufpos] = '\0'; // When time/date is received from mainboard set the Linux clock if(rcvbuf![0] == 'S') { struct mnbd_datetime_struct dt; convert_hex_to_binary(rcvbuf + 2, (unsigned char *)&dt); printf("Date/time from mainboard %d/%d/%d %d:%d:%d\r\n", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); // Set regular C tm struct to appropriate time values struct tm time; time.tm_year = dt.year - 1900; time.tm_mon = dt.month - 1; time.tm_mday = dt.day; time.tm_hour = dt.hour; time.tm_min = dt.minute; time.tm_sec = dt.second; time_t tt = mktime(&time); stime(&tt); } rcvbufpos = 0; } else if(readbuf[z] >= 0x20 && readbuf[z] < 0x7F) { rcvbuf[rcvbufpos++] = readbuf[z]; } }
Note:
See TracWiki
for help on using the wiki.