/* * Method switches the global mode */ private error_t change_glbl_mode(mode_t mode) { error_t return_error = error_t.EMAX; if (_glbl_mode == mode) { // already in requested mode, do nothing and no loss of performance _belt_error = error_t.ESUCCESS; // already in requested mode return_error = _belt_error; } else if (mode == mode_t.M_ACTIVE) { //switch to activate command mode return_error = SerialPortWriteData("BGN\n", MAX_RESPONSE_TIMEOUT); if (return_error == error_t.ESUCCESS) _glbl_mode = mode_t.M_ACTIVE; } else { //if (_glbl_mode == mode_t.M_ACTIVE) // back to learning mode byte[] returnState = { 0x30, 0x30 }; //should send Hex 0x30 0x30 = mode 0 return_error = SerialPortWriteData(returnState, MAX_RESPONSE_TIMEOUT); if (return_error == error_t.ESUCCESS) _glbl_mode = mode_t.M_LEARN; } _dll_error = return_error; return return_error; }
public static bool S_ISREG(mode_t mode) => (((mode) & S_IFMT) == S_IFREG);
/// <summary> /// Closes all COM ports in use for the wireless haptic belt. /// </summary> public error_t ClosePorts() { error_t error = error_t.COMPRTOPEN; if (serialIn != null && serialOut != null) { error = serialIn.ClosePort(); if (_portInName != _portOutName) error = serialOut.ClosePort(); } // Reset mode variables & state machine _glbl_mode = mode_t.M_LEARN; _acmd_mode = acmd_mode_t.ACM_LRN; _dll_error = error; return error; }
public static bool S_ISCHR(mode_t mode) => (((mode) & S_IFMT) == S_IFCHR);
public static bool S_ISBLK(mode_t mode) => (((mode) & S_IFMT) == S_IFBLK);
public static bool S_ISDIR(mode_t mode) => (((mode) & S_IFMT) == S_IFDIR);
public static extern int mkfifoat(int dirfd, byte *path, mode_t mode);
public static extern int mkfifo(byte *path, mode_t mode);
public static extern int mkdir(byte *path, mode_t mode);
public static extern mode_t umask(mode_t mode);