Catalyzes the reversible interconversion of maltose and trehalose by transglucosylation (PubMed:18505459). Also displays amylase activity, catalyzing the endohydrolysis of (1->4)-alpha-D-glucosidic linkages in glycogen and maltooligosaccharides such as maltoheptaose, to produce maltose which then can be converted to trehalose (PubMed:18505459). TreS plays a key role in the utilization of trehalose for the production of glycogen and alpha-glucan via the TreS-Pep2 branch involved in the biosynthesis of maltose-1-phosphate (M1P) (PubMed:18505459, PubMed:27513637). Might also function as a sensor and/or regulator of trehalose levels within the cell (PubMed:18505459). Thus, when trehalose levels in the cell become dangerously low, TreS could expedite the conversion of glycogen to maltose via its amylase activity and then convert the maltose to trehalose; but this enzyme also could expedite or promote the conversion of trehalose to glycogen when cytoplasmic trehalose levels become too high (PubMed:18505459). D-maltose = alpha,alpha-trehalose Endohydrolysis of (1->4)-alpha-D-glucosidic linkages in polysaccharides containing three or more (1->4)-alpha-linked D-glucose units. Glycan biosynthesis; glycogen biosynthesis. Capsule biogenesis; capsule polysaccharide biosynthesis. Homohexamer. Cells lacking this gene are as virulent as wild-type in mice, however also show a profound impact on intracellular and capsular glucan (PubMed:20305657, PubMed:27513637). It is not possible to inactivate Rv3032 in a mutant lacking treS, suggesting the joint essentiality of the different alpha-(1->4)-glucans biosynthesis pathways involving these two genes (PubMed:20305657). Combined inactivation of glgM and treS results in absence of alpha-glucan (PubMed:27513637). Combined inactivation of treS and glgC results in absence of alpha-glucan content and is significantly attenuated for growth in the lung and spleen of BALB/C mice during both the acute and chronic phase of infection (PubMed:27513637). Was identified as a high-confidence drug target. Maltose-1-phosphate (M1P), the building block required for alpha-glucan production, is generated by two alternative routes: the TreS-Pep2 branch and the GlgC-GlgM branch, however it seems that TreS-Pep2 branch provides most of M1P for the GlgE pathway in M.tuberculosis. Belongs to the glycosyl hydrolase 13 family. TreS subfamily.