MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / hid_for_character

Function hid_for_character

packages/server/src/api/accessibility_query.rs:509–562  ·  view source on GitHub ↗
(character: char)

Source from the content-addressed store, hash-verified

507}
508
509fn hid_for_character(character: char) -> Option<(u16, u32)> {
510 let shift: u32 = 1;
511 let mapping = match character {
512 'a'..='z' => (character as u16 - b'a' as u16 + 4, 0),
513 'A'..='Z' => (character as u16 - b'A' as u16 + 4, shift),
514 '1' => (30, 0),
515 '!' => (30, shift),
516 '2' => (31, 0),
517 '@' => (31, shift),
518 '3' => (32, 0),
519 '#' => (32, shift),
520 '4' => (33, 0),
521 '$' => (33, shift),
522 '5' => (34, 0),
523 '%' => (34, shift),
524 '6' => (35, 0),
525 '^' => (35, shift),
526 '7' => (36, 0),
527 '&' => (36, shift),
528 '8' => (37, 0),
529 '*' => (37, shift),
530 '9' => (38, 0),
531 '(' => (38, shift),
532 '0' => (39, 0),
533 ')' => (39, shift),
534 '\n' | '\r' => (40, 0),
535 '\t' => (43, 0),
536 ' ' => (44, 0),
537 '-' => (45, 0),
538 '_' => (45, shift),
539 '=' => (46, 0),
540 '+' => (46, shift),
541 '[' => (47, 0),
542 '{' => (47, shift),
543 ']' => (48, 0),
544 '}' => (48, shift),
545 '\\' => (49, 0),
546 '|' => (49, shift),
547 ';' => (51, 0),
548 ':' => (51, shift),
549 '\'' => (52, 0),
550 '"' => (52, shift),
551 '`' => (53, 0),
552 '~' => (53, shift),
553 ',' => (54, 0),
554 '<' => (54, shift),
555 '.' => (55, 0),
556 '>' => (55, shift),
557 '/' => (56, 0),
558 '?' => (56, shift),
559 _ => return None,
560 };
561 Some(mapping)
562}
563
564fn normalized_gesture_coordinates(
565 preset: &str,

Callers 2

run_batch_stepFunction · 0.70
parse_hid_keyFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected